commit bb3a6d4b5d6adafd75cd1a87fdb5f4b953e1e459
parent ad05a6db74a5aeade8a6c2a68e4241e0bf5d5a7f
Author: Chris Bracken <chris@bracken.jp>
Date: Fri, 15 May 2026 16:32:35 +0900
jj: add ws-forget alias
This cleans up a workspace created with jj ws-add.
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/.config/jj/config.toml b/.config/jj/config.toml
@@ -10,6 +10,7 @@ ll = ["log", "-T", "builtin_log_oneline", "-r", "::"]
ld = ["log", "-T", "builtin_log_detailed ++ diff.stat() ++ '\n'", "-r", "::", "--no-graph"]
lp = ["log", "-T", "builtin_log_detailed ++ diff.stat() ++ '\n' ++ diff.git() ++ '\n'", "-r", "::", "--no-graph"]
ws-add = ["util", "exec", "--", "jj-ws-add"]
+ws-forget = ["util", "exec", "--", "jj-ws-forget"]
[ui]
diff-formatter = ":git"
diff --git a/.local/bin/jj-ws-forget b/.local/bin/jj-ws-forget
@@ -0,0 +1,15 @@
+#!/usr/bin/env zsh
+set -euo pipefail
+
+if (( # == 0 )); then
+ print -u2 "Usage: jj-ws-forget <destination_path>"
+ exit 1
+fi
+
+# Resolve absolute workspace path and name.
+DEST_ABS="${1:a}"
+WS_NAME="${DEST_ABS:t}"
+
+# Forget the workspace and delete the git worktree.
+jj workspace forget "$WS_NAME"
+git worktree remove -f "$DEST_ABS"