Skip to content

jj

$ jj new # create new change
$ jj new -m "message" # create new change including description
$ jj undo # undo last operation
$ jj abandon # ditch changes
$ jj new xyz # make a new change after a change
$ jj log # show commits
$ jj st # show current status
$ jj edit xyz # edit existing change
$ jj show xyz # show info on change
$ jj diff # show diff between last change
$ jj describe -m "message"
$ jj describe @- -m "docs: add more references" # edit message on previous change
$ jj -r 'all()' # show all commits
$ jj log -r 'tags() | bookmarks()' # show tags and bookmarks
$ jj push --allow-new --remote origin # push changes
$ jj bookmark set branch_name # set a branch name
$ jj config set --user user.email "email@site.com"
$ jj config set --user user.name "First Last"
$ jj git fetch
$ jj git init --git-repo .
$ jj git remote add origin git@github.com:user/repo.git
$ jj descripion('search string') # search on commit messages
$ jj squash -i -f xyz -t abc -i 
$ jj squash -i --into x # squash into a specific change into the tree
$ jj split
$ jj new a b c # create new merge from existing changes

New repo setup

git init
jj git init --colocate

Initialize repo

$ git init --git-repo <path to repo>

Pushing

jj bookmark set main -r @-     # previous change or @ for current
jj bookmark track main@origin  # only need one time per branch
jj git push -r @-

Examples

https://github.com/jj-vcs/jj/blob/main/docs/revsets.md#examples

operators

https://github.com/jj-vcs/jj/blob/main/docs/revsets.md#operators

list changes between bookmarks that are pushed to a remote

$ jj log -r 'ancestors(@) & main::'

bookmark a change

This locks the changes below from editing once pushed up

$ jj bookmark set branch

Listing bookmarks

Show all remote bookmarks by an author

$ jj -r 'remote_bookmarks() & author("icecreammatt")'

Show all with a given name

$ jj -r 'bookmarks("branch-name")'

Recover or undo changes that were a while ago

$ jj op log
# find the operational state you wish to restore to
$ jj op restore <operation id>

Inspect what an operation did

$ jj op show <operation id>

References