jj-cli 0.41.0

Jujutsu - an experimental version control system
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
- Use case: Create a new repo
  Git command: >
    `git init`
  Jujutsu 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 status`
  Jujutsu command: >
    `jj st`
  Notes: ''

- Use case: Show diff of the current change
  Git command: >
    `git diff HEAD`
  Jujutsu command: >
    `jj diff`
  Notes: ''

- 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 B`
  Jujutsu command: >
    `jj diff --from A --to B`
  Notes: ''

- Use case: Show all the changes in A..B
  Git command: >
    `git diff A...B`
  Jujutsu command: >
    `jj diff -r A..B`
  Notes: ''

- 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 filename`
  Jujutsu command: >
    `touch filename`
  Notes: ''

- Use case: Remove a file from the current change
  Git command: >
    `git rm filename`
  Jujutsu command: >
    `rm filename`
  Notes: ''

- Use case: Remove a previously tracked file from the current change, but keep it in the working copy
  Git command: >
    `git rm --cached filename`
  Jujutsu command: >
    `jj file untrack filename`
  Notes: 'File name must match an ignore pattern to remain untracked. See <a href="../working-copy/#introduction">the documentation for working copies</a> for more.'

- Use case: Modify a file in the current change
  Git command: >
    `echo stuff >> filename`
  Jujutsu command: >
    `echo stuff >> filename`
  Notes: ''

- Use case: Finish work on the current change and start a new change
  Git command: >
    `git commit -a`
  Jujutsu command: >
    `jj commit`
  Notes: ''

- Use case: See compact log graph of ancestors of the current commit
  Git command: >
    `git log --oneline --graph`
  Jujutsu command: >
    `jj log -r ::@`
  Notes: ''

- Use case: See compact log graph of all reachable commits
  Git command: >
    `git log --oneline --graph --all`
  Jujutsu command: >
    `jj log -r 'all()'`
    or `jj 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 `--all` by `--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/main`
  Jujutsu command: >
    `jj log`
  Notes: ''

- 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 stuff`
  Jujutsu command: >
    `jj log -r 'diff_lines(regex:stuff)'`
  Notes: ''

- Use case: List versioned files in the working copy
  Git command: >
    `git ls-files --cached`
  Jujutsu command: >
    `jj file list`
  Notes: ''

- Use case: Search among files versioned in the repository
  Git command: >
    `git grep foo`
  Jujutsu command: >
    `grep foo $(jj file list)`
    or `rg --no-require-git foo`
  Notes: ''

- Use case: Abandon the current change and start a new change
  Git command: >
    `git reset --hard`
    (cannot be undone)
  Jujutsu command: >
    `jj abandon`
  Notes: ''

- 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 restore`
  Notes: ''

- 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>...`
    or `git 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 describe`
  Notes: ''

- Use case: Edit description (commit message) of the previous change
  Git command: >
    `git commit --amend --only`
  Jujutsu 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 X`
  Notes: ''

- Use case: Temporarily put away the current change
  Git command: >
    `git stash`
  Jujutsu command: >
    `jj new @-`
  Notes: >
    The old working-copy commit remains as a sibling commit.
    The old working-copy commit X can be restored with `jj edit X`.

- Use case: Start working on a new change based on the <main> bookmark/branch
  Git command: >
    `git switch -c topic main`
    or `git checkout -b topic main`
    (may need to stash or commit first)
  Jujutsu command: >
    `jj new main`
  Notes: ''

- Use case: Merge branch A into the current change
  Git command: >
    `git merge A`
  Jujutsu command: >
    `jj new @ A`
  Notes: ''

- Use case: Check out a named revision (or branch) to examine source
  Git command: >
    `git checkout v1.0.1`
  Jujutsu command: >
    `jj new v1.0.1`
  Notes: 'Creates new empty change on top (see `jj 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 B`
  Notes: ''

- 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 B`
  Notes: ''

- Use case: Reorder changes from A-B-C-D to A-C-B-D
  Git command: >
    `git rebase -i A`
  Jujutsu command: >
    `jj rebase -r C --before B`
  Notes: ''

- Use case: Reorder multiple commits at once
  Git command: >
    `git rebase -i`
  Jujutsu command: >
    `jj arrange`
  Notes: ''

- Use case: Move the diff in the current change into the parent change
  Git command: >
    `git commit --amend -a`
  Jujutsu command: >
    `jj squash`
  Notes: ''

- Use case: Interactively move part of the diff in the current change into the parent change
  Git command: >
    `git add -p; git commit --amend`
  Jujutsu command: >
    `jj squash -i`
  Notes: ''

- 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 X`
  Notes: ''

- 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 Y`
  Notes: ''

- Use case: Interactively split the changes in the working copy in two
  Git command: >
    `git commit -p`
  Jujutsu command: >
    `jj split`
  Notes: ''

- 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
    --continue`
  Jujutsu command: >
    `echo resolved > filename; jj squash`
  Notes: 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-toplevel`
  Jujutsu command: >
    `jj workspace root`
  Notes: ''

- Use case: List bookmarks/branches
  Git command: >
    `git branch`
  Jujutsu command: >
    `jj bookmark list`
    or `jj b l` for 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>`
    or `jj 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-backwards`
  Notes: ''

- 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 -l`
  Jujutsu command: >
    `jj tag list`
  Notes: ''

- 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 log`
  Notes: ''

- Use case: Undo the last operation
  Git command: Not supported
  Jujutsu command: >
    `jj undo`
  Notes: >
    There is also a matching `jj redo` command to redo the most recently undone
    operation.

- Use case: Revert an earlier operation
  Git command: Not supported
  Jujutsu command: >
    `jj op revert`
  Notes: ''

- 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: ''