Skip to content

Instantly share code, notes, and snippets.

@storopoli
Created January 8, 2026 08:43
Show Gist options
  • Select an option

  • Save storopoli/41b072c76790e0bfd2517bd0f5ed8e5c to your computer and use it in GitHub Desktop.

Select an option

Save storopoli/41b072c76790e0bfd2517bd0f5ed8e5c to your computer and use it in GitHub Desktop.
Jujutsu Config
# depends on fzf gh
# inspired by https://andre.arko.net/2025/09/28/stupid-jj-tricks/
[user]
name = "Jose Storopoli"
email = "jose@storopoli.com"
[ui]
default-command = ["status"]
diff-editor = ":builtin"
diff-formatter = ":git"
[signing]
behavior = "own"
backend = "ssh"
key = "~/.ssh/secretive_signing_key.pub"
[signing.backends]
allowed-signers = "~/.ssh/allowed_signers"
[git]
sign-on-push = true
[revset-aliases]
"user(x)" = "author(x) | committer(x)"
"mine()" = "user('jose@storopoli.com') | user('jose@alpenlabs.io')"
"wip()" = "description(glob:'wip:*')"
"private()" = "description(glob:'private:*')"
"stack()" = "stack(@)"
"stack(x)" = "stack(x, 2)"
"stack(x, n)" = "ancestors(reachable(x, mutable()), n)"
"open()" = "stack(mine() | @, 1)"
"ready()" = "open() ~ descendants(wip() | private())"
"uninterested()" = "::remote_bookmarks() | tags()"
"interested()" = "mine() ~ uninterested()"
"closest_pushable(to)" = "heads(::to & mutable() & ~description(exact:'') & (~empty() | merges()))"
"closest_bookmark(to)" = "heads(::to & bookmarks())"
[template-aliases]
"in_branch(commit)" = 'commit.contained_in("immutable_heads()..bookmarks()")'
[aliases]
l = ["log"]
tug = ["bookmark", "move", "--from", "heads(::@- & bookmarks())", "--to", "@-"]
pr = [
"util",
"exec",
"--",
"bash",
"-c",
"gh pr create --head $(jj log -r 'closest_bookmark(@)' -T 'bookmarks' --no-graph | cut -d ' ' -f 1)",
]
init = [
"util",
"exec",
"--",
"bash",
"-c",
"""
jj git init --colocate
# only track origin branches, not upstream or others
jj bookmark track 'glob:*@origin'
"""
]
pull = [
"util",
"exec",
"--",
"bash",
"-c",
"""
closest="$(jj log -r 'closest_bookmark(@)' -n 1 -T 'bookmarks' --no-graph | cut -d ' ' -f 1)"
closest="${closest%\\*}"
jj git fetch
jj log -n 1 -r "${closest}" 2>&1 > /dev/null && jj rebase -d "${closest}" || jj rebase -d 'trunk()'
jj log -r 'stack()'
""",
]
push = [
"util",
"exec",
"--",
"bash",
"-c",
"""
tuggable="$(jj log -r 'closest_bookmark(@)..closest_pushable(@)' -T '"n"' --no-graph)"
[[ -n "$tuggable" ]] && jj tug
pushable="$(jj log -r 'remote_bookmarks(remote=origin)..@' -T 'bookmarks' --no-graph)"
[[ -n "$pushable" ]] && jj git push --allow-new || echo "Nothing to push."
closest="$(jj log -r 'closest_bookmark(@)' -n 1 -T 'bookmarks' --no-graph | cut -d ' ' -f 1)"
closest="${closest%\\*}"
tracked="$(jj bookmark list -r ${closest} -t -T 'if(remote == "origin", name)')"
[[ "$tracked" == "$closest" ]] || jj bookmark track "${closest}@origin"
""",
]
z = ["fuzzy_bookmark"]
za = ["bookmark", "list", "-a"]
fuzzy_bookmark = [
"util",
"exec",
"--",
"sh",
"-c",
"""
if [ "x$1" = "x" ]; then
jj bookmark list
else
jj bookmark list -a -T 'separate("@", name, remote) ++ "\\n"' 2> /dev/null | sort | uniq | fzf -f "$1" | head -n1 | xargs jj new
fi
""",
"",
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment