sgjennings
Most importantly, I get in this situation less often in the first place. Because reodering and squashing commits can be done with an easy command[1], I tend to squash or rebase as I think of it instead of batching it up to do all at once.
Many times, I don't need to manually target which commit to squash into at all, because I can be editing at the tip of the branch, then use `jj absorb` to automatically squash all my changes down into the commits where they belong.[2]
And `jj undo` is just easier to use than the reflog[3]. While reading the reflog you posted, I have to mentally replay each commit step by step. But really, if I messed something up, it's most likely I want to just go back to `HEAD@{31}`. `jj rebase` is atomic, so the whole thing is undone with one invocation of `jj undo`.
[1]: https://docs.jj-vcs.dev/latest/git-experts/#automatic-and-sa...
[2]: https://docs.jj-vcs.dev/latest/git-experts/#jj-absorb-makes-...
[3]: https://docs.jj-vcs.dev/latest/git-experts/#undo-is-more-pow...
> jj bookmark move
Presumably, this part is reasonably clear. “I want to move a bookmark.”
> main
Which bookmark to move. I think this is probably clear from context?
> --to @-
And here’s the part that looks foreign to a non-jj user. This syntax is familiar to jj users because the same revset syntax is used across the whole CLI. `@` is the working copy commit (the commit you have “checked out” that you are currently editing), and `@-` specifies its parent.
Because it’s just a revset, you could specify that same command in a number of ways:
- If you know the parent’s commit ID or change ID, you could use that instead: `--to abc123`
- If there happens to be another bookmark already there, you can use its name: `--to other-feature`
- You probably wouldn’t type this in the terminal, but you could do exotic things like `--to 'mutable() & description("foobar2000")'` to assign the bookmark to the work-in-progress commit that has "foobar2000" in the commit message.
Revsets used pervasively are one of the things that make the DX lovely.
1. Your working copy contains whatever mish-mash of changes you want.
2. When you’re ready to stage and commit these changes, run `jj commit --tool gitpatch`
3. The iterative “stage this hunk?” UI from git lets you choose what to commit.
4. Your editor opens for a commit message.
5. The changes you selected are now in a new parent commit of your working copy, and the remaining changes are left in the working copy commit.
In addition to the _same_ workflow, jj makes it easier to have other workflows as well (you may be interested in the megamerge workflow if you’re always working on multiple tasks at once).
[1]: https://zerowidth.com/2025/jj-tips-and-tricks/#hunk-wise-sty...
As the parents of M are merged, I rebase the whole stack. When M has a single parent left, I abandon M and retarget the PR to merge R into that parent.
It requires a little babysitting, but the PR shows the diff I want it to.
- Make a commit off main that includes these private changes
- Make a commit for the work you’re doing
- Create a merge commit on top of these two changes and work there
This works because the “DEBUG=true” change is already committed, but in a commit you never push to the remote. jj makes it easy to continually squash the work you want to keep from the merge commit into one where it belongs. And, there is a “private commits” setting you can use to prevent accidentally pushing that commit somewhere.