How to start (without breaking GitHub)#
-
In an existing Git repo: run this once in the repo root
jj git init --colocate(This makes the repo usable by both Git and jj.) -
Or clone a GitHub repo directly with jj:
jj git clone https://github.com/owner/repo.git -
Configure the remote as usual (jj uses Git remotes):
jj git remote add origin <url> -
Push:
jj git push --allor push a single bookmark:jj git push --bookmark main -
Pull/update (jj doesn’t have a one-shot pull):
jj git fetch→ then rebase your work:jj rebase -d <bookmark you track, e.g. main>
Git ⇄ jj cheat-sheet (most common)#
(Left: Git command → Right: jj equivalent)
git init → jj git init [--colocate]
git clone <url> → jj git clone <url>
git status → jj st
git diff → jj diff
git show <rev> → jj show <rev>
git log --oneline --graph → jj log -r ::@ (or jj log)
git fetch → jj git fetch
git push --all → jj git push --all
git push origin <branch> → jj git push --bookmark <name> [--remote origin]
git branch (list) → jj bookmark list
git branch <name> <rev> → jj bookmark create <name> -r <rev>
git branch -f <name> <rev> → jj bookmark move <name> --to <rev>
git branch -d <name> → jj bookmark delete <name>
git switch -c topic main → jj new main (start a new change on top of main)
git merge A → jj new @ A (create a merge change with A)
git rebase B A → jj rebase -b A -d B
git cherry-pick X → jj duplicate X -d <destination>
git commit -a → jj commit (finish current change, start a new one)
git commit --amend → jj squash (or jj describe to edit the message)
git restore <paths> / git checkout -- <paths> → jj restore <paths>
git reset --hard (drop WIP) → jj abandon
git revert <rev> → jj revert -r <rev> -B @
git blame <file> → jj file annotate <path>
A couple of jj concepts to know#
Bookmarks ≈ Branches: jj uses bookmarks that map 1:1 to Git branches when you push/fetch. So jj git push --bookmark foo updates branch foo on GitHub.
Working copy is a real commit: edits update your current change; you “finish” it with jj commit, and tools like jj split, jj squash, and jj rebase make rewriting history much nicer.