Jujutsu seems to have been steadily gaining popularity recently. (Linked to a few resources to start and recent popular posts about jujutsu I’ve seen)
One thing that I wish it came built-in with the intended workflow is a way to mark something as WIP (work-in-progress), as we usually start the work by describing the “commit” and then actually work on it. Occasionally, I would need to switch out from the work to work on some bug fixes and switch back and I would like to clearly mark some work as WIP. While jujutsu
does have a pretty sane log
graphing default, having a 🚧 mark just makes it easier for me to identify what’s going on as the outstanding commits are growing.
I’ve recently added this alias to my jj config (~/.jjconfig.toml
):
[aliases]
wip = ["util", "exec", "--", "bash", "-c", """
#!/usr/bin/env bash
# Toggle “WIP: ” prefix on the checked‑out jujutsu commit message.
set -euo pipefail
prefix='WIP: '
desc=$(jj log -r @ -T 'description' --no-graph)
first=${desc%%$'\n'*}
rest=${desc#"$first"}
[[ "$rest" != "$desc" ]] && rest=${rest#$'\n'}
if [[ "$first" == "$prefix"* ]]; then
first=${first#"$prefix"}
else
first="${prefix}${first}"
fi
[[ -n "$rest" ]] && new_desc="$first"$'\n'"$rest" || new_desc="$first"
jj describe -m "$new_desc"
""", ""]
which allows you to run jj wip
to quickly toggle WIP:
tag on the current commit.
❯ jj wip
Working copy (@) now at: pxyvvlwu 8e2645a3 WIP: [backend] XXX
❯ jj wip
Working copy (@) now at: pxyvvlwu c4463076 [backend] XXX