Skip to content

Instantly share code, notes, and snippets.

@dstanek
Created March 19, 2026 14:49
Show Gist options
  • Select an option

  • Save dstanek/57eea5fac15876a57990a3681dd82046 to your computer and use it in GitHub Desktop.

Select an option

Save dstanek/57eea5fac15876a57990a3681dd82046 to your computer and use it in GitHub Desktop.
# Jujutsu (jj) Configuration File
'$schema' = 'https://jj-vcs.github.io/jj/latest/config-schema.json'
[ui]
default-command = 'status'
# Tool used for interactive diff editing
# diff-editor = 'meld' # Alternative: Meld GUI merge tool
# Tool/formatter for displaying diffs in the terminal
# difft provides syntax-aware structural diffs
diff-formatter = ['difft', '--background=dark', '--color=always', '--width=140', '$left', '$right']
# diff-formatter = 'delta' # Alternative: Delta pager with syntax highlighting
# diff-formatter = ':git' # Alternative: Use git 's default diff format
# Tool used for resolving merge conflicts
merge-editor = 'diffconflicts'
# merge-editor = 'meld' # Alternative: Meld GUI merge tool
[colors]
# Make the author more prominent in the log output
'working_copy author' = 'bright white'
'author' = 'white'
# Git Integration Settings
[git]
# Whether to colocate jj repository with git repository
# false means jj stores its data separately from .git
colocate = false
[revsets]
#log = '@ | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()'
#log = "stack(bookmarks() | @, 1) | present(trunk())"
#log = '@ | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()'
log = '@ | ancestors(trunk()..visible_heads(), 2) | trunk()'
[revset-aliases]
stragglers = 'immutable()+ ~ immutable()'
# stack(x, n): mutable commits reachable from x, plus n parents for context
"stack(x, n)" = "ancestors(reachable(x, mutable()), n)"
"stack(x)" = "stack(x, 2)"
"stack()" = "stack(@)"
# Template Aliases; custom template functions for formatting output
[template-aliases]
# Formats email signatures by showing only the local part (before @)
'format_short_signature(signature)' = 'signature.email().local()'
# Formats commit IDs by showing at least 8 characters
'format_short_id(id)' = 'id.shortest(8)'
# Automatically create local bookmarks for new remote bookmarks during fetch
# This keeps your local bookmarks in sync with remote branches
[remotes.origin]
auto-track-bookmarks = 'glob:*'
[remotes.upstream]
auto-track-bookmarks = 'main'
# Command Aliases
[aliases]
#
# Git Integration
#
# 'jj clone <url>' → clones a Git repo using jj
clone = ['git', 'clone']
# 'jj ig' → initializes jj in an existing Git repo
ig = ['git', 'init', '--git-repo=.']
#
# Branch Management
#
# 'jj setmain' → sets the 'main' bookmark to the parent of current commit
setmain = ['bookmark', 'set', 'main', '-r', '@-']
# 'jj sync' → fetches from all Git remotes
sync = ['git', 'fetch', '--all-remotes']
#
# Rebasing Workflows
#
# 'jj onmain' → rebases current commit directly onto main
onmain = ['rebase', '-s', '@', '-d', 'main']
# 'jj evolve' → rebases current work onto main, removing empty commits
evolve = ['rebase', '--skip-emptied', '-d', 'main']
# 'jj pullup' → rebases all 'straggler' commits onto main
pullup = ['evolve', '-s', 'stragglers']
# 'jj rebase-all' → rebase all your mutable branch heads onto main
rebase-all = [ 'rebase', '--skip-emptied', '-b', 'heads(mutable() & mine())', '-d', 'main']
## Rebase Example
#
# Imagine you have:
# ```
# main: A---B---C (updated)
# \
# D---E (@, current branch)
# \
# F---G (another branch)
#
# jj onmain → Moves only E to C
# jj evolve → Moves D and E to C
# jj pullup → Would only affect commits that got orphaned from immutable ancestors`
# jj rebase-all → Fetches, then moves both branches (D-E and F-G) to C
# 'jj amend' → squashes changes into the parent commit (like git commit --amend)
amend = ['squash']
#
# Log Viewing
#
# 'jj xl' → shows extended log of all commits
xl = ['log', '-r', 'all()']
# 'jj pl' → shows predecessor log with patches (history of how a commit evolved)
pl = ['obslog', '-p']
log-stack = ['log', '-r', 'ancestors(@) ~ ancestors(main)']
#
# Pushing Changes
#
# 'jj cl' → creates and pushes the parent commit (useful for creating PRs)
cl = ['git', 'push', '-c', '@-']
# 'jj push' → pushes all branches to Git remote
push = ['git', 'push', '--all']
#
# Navigation Shortcuts
#
# 'jj ..' → checks out the parent commit
'..' = ['edit', '-r', '@-']
# 'jj ,,' → checks out the child commit
',,' = ['edit', '-r', '@+']
#
# Other Utilities
#
# 'jj configure' → opens the repo-specific config file for editing
configure = ['config', 'edit', '--repo']
# 'jj blame' → shows file annotations (who changed what line when)
blame = ['file', 'annotate']
# 'jj mdiff' → shows diff between main and current commit
mdiff = ['diff', '--from', 'main']
ls = ['log', '--no-graph', '-T', 'diff.files().map(|f| f.target().path()).join("\n") ++ "\n"']
show-empty = ['log', '-r', 'empty() & mutable() ~ merges()']
clear-empty = ['abandon', '-r', 'empty() & mutable() ~ merges()']
[merge-tools.difft]
diff-args = ['--color=always', '$left', '$right']
# Process diffs one file at a time rather than all at once
diff-invocation-mode = 'file-by-file'
[merge-tools.diffconflicts]
program = 'nvim'
merge-args = [
'-c', 'let g:jj_diffconflicts_marker_length=$marker_length',
'-c', 'JJDiffConflicts!', '$output', '$base', '$left', '$right',
]
merge-tool-edits-conflict-markers = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment