Hacker News new | ask | show | jobs
by SAI_Peregrinus 291 days ago
One way (there are other ways to do some things):

`jj log` if needed to see what revision ID you need to use

`jj new <starting revision> -m <message>` to create a new change with a given message with <starting revision> as the parent. (you can also use the `--insert-before <revset>` and/or `--insert-after <revset>` to set the parent & child revison(s) for the new revision).

`jj bookmark set <feature 1 name> --revision <revset>` to make a bookmark (a branch name) on the revison you just made.

Make changes on this branch as desired. `jj new` for each new change you want to have its own revision.

If you added more revisions to the branch, `jj bookmark move <feature 1 name> --to '@'` (you can also use the change ID instead of '@', '@' just means "the current change you're editing").

`jj edit <starting revset>` to go back to your starting revset.

`jj new -m <message>` to make a new revset on top of the starting revset (the starting revset now has two children: it has branched)

`jj bookmark set <feature 2 name> --revision <revset>` to name the second branch you just created.

Make changes as desired. `jj new` for each new change you want to have its own revision.

If you added more revisions to the branch, `jj bookmark move <feature 2 name> --to '@'`.

`jj new <feature 1 name> <feature 2 name> -m "merge feature 1 & feature 2"` to make a new revision with the feature 1 & feature 2 bookmark revisions as its parents (this is a merge).

Alternatively, you could use `jj rebase` to move any number of commits to anywhere in the commit graph you want.