-
Use case: Create a new repo Git command: >
git initJujutsu command: >jj git init [--no-colocate]Notes: -
Use case: Clone an existing repo Git command: >
git clone \<source\> \<destination\> [--origin \<remote name\>]Jujutsu command: >jj git clone \<source\> \<destination\> [--remote \<remote name\>]Notes: There is no support for cloning non-Git repos yet.
TODO: Mention that you might need to do a jj bookmark track branch to see
the bookmark in jj log.
- Use case: Update the local repo with all bookmarks/branches from a remote
Git command: >
git fetch [\<remote\>]Jujutsu command: >jj git fetch [--remote \<remote\>]Notes: There is no support for fetching into non-Git repos yet.
TODO: This only affects tracked branches now.
-
Use case: Update a remote repo with all bookmarks/branches from the local repo Git command: >
git push --all [\<remote\>]Jujutsu command: >jj git push --all [--remote \<remote\>]Notes: There is no support for pushing from non-Git repos yet. -
Use case: Update a remote repo with a single bookmark from the local repo Git command: >
git push \<remote\> <bookmark name>Jujutsu command: >jj git push --bookmark <bookmark name> [--remote \<remote\>]Notes: There is no support for pushing from non-Git repos yet. -
Use case: Add a remote target to the repo Git command: >
git remote add \<remote\> \<url\>Jujutsu command: >jj git remote add \<remote\> \<url\>Notes: -
Use case: Show summary of current work and repo status Git command: >
git statusJujutsu command: >jj statusNotes: -
Use case: Show diff of the current change Git command: >
git diff HEADJujutsu command: >jj diffNotes: -
Use case: Show diff of another change Git command: >
git diff \<revision\>^ \<revision\>Jujutsu command: >jj diff -r \<revision\>Notes: -
Use case: Show diff from another change to the current change Git command: >
git diff \<revision\>Jujutsu command: >jj diff --from \<revision\>Notes: -
Use case: Show diff from change A to change B Git command: >
git diff A BJujutsu command: >jj diff --from A --to BNotes: -
Use case: Show all the changes in A..B Git command: >
git diff A...BJujutsu command: >jj diff -r A..BNotes: -
Use case: Show description and diff of a change Git command: >
git show \<revision\>Jujutsu command: >jj show \<revision\>Notes: -
Use case: Add a file to the current change Git command: >
touch filename; git add filenameJujutsu command: >touch filenameNotes: -
Use case: Remove a file from the current change Git command: >
git rm filenameJujutsu command: >rm filenameNotes: -
Use case: > Remove a previously tracked file from the current change, but keep it in the working copy Git command: >
git rm --cached filenameJujutsu command: >jj file untrack filenameNotes: > File name must match an ignore pattern to remain untracked. See the documentation for working copies for more. -
Use case: Modify a file in the current change Git command: >
echo stuff >> filenameJujutsu command: >echo stuff >> filenameNotes: -
Use case: Finish work on the current change and start a new change Git command: >
git commit -aJujutsu command: >jj commitNotes: -
Use case: See compact log graph of ancestors of the current commit Git command: >
git log --oneline --graphJujutsu command: >jj log -r ::@Notes: -
Use case: See compact log graph of all reachable commits Git command: >
git log --oneline --graph --allJujutsu command: >jj log -r 'all()'orjj log -r ::Notes: > In a Git-backed Jujutsu repository the Git command will also show all commits preserved by Jujutsu, including hidden commits. To exclude all commits only preserved by Jujutsu, replace--allby--exclude refs/jj/* --all. This will also exclude the Jujutsu-reachable commits though, if they are not Git-reachable. -
Use case: Show compact log graph of commits not on the main branch Git command: >
git log --oneline --graph --branches --not upstream/mainJujutsu command: >jj logNotes: -
Use case: > Show log of commits that have the string “stuff” in the changed lines, also known as the “pickaxe” in Git Git command: >
git log -G stuffJujutsu command: >jj log -r 'diff_lines(regex:stuff)'Notes: -
Use case: List versioned files in the working copy Git command: >
git ls-files --cachedJujutsu command: >jj file listNotes: -
Use case: Search among files versioned in the repository Git command: >
git grep fooJujutsu command: >jj file search --pattern=fooorrg --no-require-git fooNotes: -
Use case: Abandon the current change and start a new change Git command: >
git reset --hard(cannot be undone) Jujutsu command: >jj abandonNotes: -
Use case: Make the current change empty Git command: >
git reset --hard(same as abandoning a change since Git has no concept of a “change”) Jujutsu command: >jj restoreNotes: -
Use case: Abandon the parent of the working copy, but keep its diff in the working copy Git command: >
git reset --soft HEAD~Jujutsu command: >jj squash --from @-Notes: -
Use case: Discard working copy changes in some files Git command: >
git restore \<paths\>...orgit checkout HEAD -- \<paths\>...Jujutsu command: >jj restore \<paths\>...Notes: -
Use case: Edit description (commit message) of the current change Git command: Not supported Jujutsu command: >
jj describeNotes: -
Use case: Edit description (commit message) of the previous change Git command: >
git commit --amend --onlyJujutsu command: >jj describe @-Notes: -
Use case: Edit description (commit message) of any change Git command: >
git commit --fixup=reword:X; git rebase --autosquash X^Jujutsu command: >jj describe XNotes: -
Use case: Temporarily put away the current change Git command: >
git stashJujutsu command: >jj new @-Notes: > The old working-copy commit remains as a sibling commit. The old working-copy commit X can be restored withjj edit X. -
Use case: Start working on a new change based on the <main> bookmark/branch Git command: >
git switch -c topic mainorgit checkout -b topic main(may need to stash or commit first) Jujutsu command: >jj new mainNotes: -
Use case: Merge branch A into the current change Git command: >
git merge AJujutsu command: >jj new @ ANotes: -
Use case: Check out a named revision (or branch) to examine source Git command: >
git checkout v1.0.1Jujutsu command: >jj new v1.0.1Notes: Creates new empty change on top (seejj new main) -
Use case: Move bookmark/branch A onto bookmark/branch B Git command: >
git rebase B A(may need to rebase other descendant branches separately) Jujutsu command: >jj rebase -b A -o BNotes: -
Use case: Move change A and its descendants onto change B Git command: >
git rebase --onto B A^ \<some descendant bookmark\>(may need to rebase other descendant bookmarks separately) Jujutsu command: >jj rebase -s A -o BNotes: -
Use case: Reorder changes from A-B-C-D to A-C-B-D Git command: >
git rebase -i AJujutsu command: >jj rebase -r C --before BNotes: -
Use case: Reorder multiple commits at once Git command: >
git rebase -iJujutsu command: >jj arrangeNotes: -
Use case: Move the diff in the current change into the parent change Git command: >
git commit --amend -aJujutsu command: >jj squashNotes: -
Use case: Interactively move part of the diff in the current change into the parent change Git command: >
git add -p; git commit --amendJujutsu command: >jj squash -iNotes: -
Use case: Move the diff in the working copy into an ancestor Git command: >
git commit --fixup=X; git rebase --autosquash X^Jujutsu command: >jj squash --into XNotes: -
Use case: Interactively move part of the diff in an arbitrary change to another arbitrary change Git command: Not supported Jujutsu command: >
jj squash -i --from X --into YNotes: -
Use case: Interactively split the changes in the working copy in two Git command: >
git commit -pJujutsu command: >jj splitNotes: -
Use case: Interactively split an arbitrary change in two Git command: > Not supported (can be emulated with the “edit” action in
git rebase -i) Jujutsu command: >jj split -r \<revision\>Notes: -
Use case: Interactively edit the diff in a given change Git command: > Not supported (can be emulated with the “edit” action in
git rebase -i) Jujutsu command: >jj diffedit -r \<revision\>Notes: -
Use case: Resolve conflicts and continue interrupted operation Git command: >
echo resolved > filename; git add filename; git rebase/merge/cherry-pick --continueJujutsu command: >echo resolved > filename; jj squashNotes: Operations don’t get interrupted, so no need to continue. -
Use case: Create a copy of a commit on top of another commit Git command: >
git co \<destination\>; git cherry-pick \<source\>Jujutsu command: >jj duplicate \<source\> -o \<destination\>Notes: -
Use case: Find the root of the working copy (or check if in a repo) Git command: >
git rev-parse --show-toplevelJujutsu command: >jj workspace rootNotes: -
Use case: List bookmarks/branches Git command: >
git branchJujutsu command: >jj bookmark listorjj b lfor short Notes: -
Use case: Create a bookmark/branch Git command: >
git branch \<name\> \<revision\>Jujutsu command: >jj bookmark create \<name\> -r \<revision\>Notes: -
Use case: Move a bookmark/branch forward Git command: >
git branch -f \<name\> \<revision\>Jujutsu command: >jj bookmark move \<name\> --to \<revision\>orjj b m \<name\> -t \<revision\>for short Notes: -
Use case: Move a bookmark/branch backward or sideways Git command: >
git branch -f \<name\> \<revision\>Jujutsu command: >jj bookmark move \<name\> --to \<revision\> --allow-backwardsNotes: -
Use case: Delete a bookmark/branch Git command: >
git branch --delete \<name\>Jujutsu command: >jj bookmark delete \<name\>Notes: -
Use case: List tags Git command: >
git tag -lJujutsu command: >jj tag listNotes: -
Use case: Create a tag Git command: >
git tag \<name\> \<revision\>Jujutsu command: >jj tag set \<name\> -r \<revision\>Notes: -
Use case: Delete a tag Git command: >
git tag -d \<name\>Jujutsu command: >jj tag delete \<name\>Notes: -
Use case: List tags that contain a revision (targets are descendants of the revision) Git command: >
git tag --contains \<revision\>Jujutsu command: >jj tag list -r '\<revision\>::'Notes: > Uses jj’s revset language. The::postfix operator selects all descendants of the given revision. -
Use case: List tags merged into a revision (targets are ancestors of the revision) Git command: >
git tag --merged \<revision\>Jujutsu command: >jj tag list -r '::\<revision\>'Notes: > Uses jj’s revset language. The::prefix operator selects all ancestors of the given revision. -
Use case: See log of operations performed on the repo Git command: Not supported Jujutsu command: >
jj op logNotes: -
Use case: Undo the last operation Git command: Not supported Jujutsu command: >
jj undoNotes: > There is also a matchingjj redocommand to redo the most recently undone operation. -
Use case: Revert an earlier operation Git command: Not supported Jujutsu command: >
jj op revertNotes: -
Use case: Create a commit that cancels out a previous commit Git command: >
git revert \<revision\>Jujutsu command: >jj revert -r \<revision\> -B @Notes: -
Use case: Show what revision and author last modified each line of a file Git command: >
git blame \<file\>Jujutsu command: >jj file annotate \<path\>Notes: