Skip to content

Instantly share code, notes, and snippets.

@jordanst3wart
Last active October 26, 2025 23:17
Show Gist options
  • Save jordanst3wart/114eb6b1ab628616f2af59ab5dcb9228 to your computer and use it in GitHub Desktop.
Save jordanst3wart/114eb6b1ab628616f2af59ab5dcb9228 to your computer and use it in GitHub Desktop.

Common commands and workflows to use with jj

Largely from: https://jj-vcs.github.io/jj/latest/github/

# setup git repo
jj git init --colocate


# push commit
jj git push -c @-

# commit
jj commit -m "add foo"

# update main
jj git fetch
jj rebase -d main # or master
# soon jj git sync

# describe

# with named branches...
# Start a new commit off of the default bookmark.
jj new main
# Refactor some files, then add a description and start a new commit
jj commit -m 'refactor(foo): restructure foo()'
# Add a feature, then add a description and start a new commit
jj commit -m 'feat(bar): add support for bar'
# Create a bookmark so we can push it to GitHub. Note that we created the bookmark
# on the working-copy commit's *parent* because the working copy itself is empty.
jj bookmark create bar -r @- # `bar` now contains the previous two commits.
# Push the bookmark to GitHub (pushes only `bar`)  
jj git push # --allow-new if not configured in settings

# with anonymous branches
# Start a new commit off of the default bookmark.
jj new main
# Refactor some files, then add a description and start a new commit
jj commit -m 'refactor(foo): restructure foo()'
# Add a feature, then add a description and start a new commit
jj commit -m 'feat(bar): add support for bar'
# Let Jujutsu generate a bookmark name and push that to GitHub. Note that we
# push the working-copy commit's *parent* because the working-copy commit
# itself is empty.
jj git push -c @-

Rebase branches/bookmarks... (-b is branch, -d is destination or something)

jj rebase -b feature_branch -d master@origin

someone else's cheatsheet: https://justinpombrio.net/src/jj-cheat-sheet.pdf

pushing directly to main: jj-vcs/jj#3135

maybe:

jj git push -b main

Or:

jj git push --named main=@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment