News for hackers. Stuff that matters.
Re:Stacked Diffs with git rebase —onto by ndr on Friday December 05, 2025 @06:12AM (#46159737)
The main issue I kept having when trying to do this with just git is then managing all the branch names to be attached to the right moved commits, so that my stack could be reviewable on github's open PRs.

Does jj help with that at all?

I've experimented a bit with git-town.com (OSS) and now everyone at $DAYJOB uses graphite.com (SaaS) which does that part very well.

Re:Stacked Diffs with git rebase —onto by baq on Friday December 05, 2025 @06:35AM (#46159927)
It’s one of the core features that rebases, including branch names (bookmarks in jj) work ‘correctly’. You can rebase whole dags, including merges, with multiple named heads with just one jj rebase -b.
Re:Stacked Diffs with git rebase —onto by arccy on Friday December 05, 2025 @07:14AM (#46160253)
note that bookmarks don't float, unlike git branches, so if your pattern is to produce a lot of commits, you'll want something to keep your jj bookmarks pointing to the top of your pile of commits.

this is less of a problem if you're more into the 1 change == 1 commit workflow.

Re:Stacked Diffs with git rebase —onto by pimeys on Friday December 05, 2025 @07:18AM (#46160283)
There's a very common alias `jj tug` for this case:

  tug = ["bookmark", "move", "--from", "heads(::@- & bookmarks())", "--to", "@-"]
It moves the nearest bookmark to the commit before the current one (which should be your working commit).
Re:Stacked Diffs with git rebase —onto by stavros on Friday December 05, 2025 @07:47AM (#46160557)
Thanks, I replaced my Frankenstein's monster of a parsing pipeline with this, very useful!
Re:Stacked Diffs with git rebase —onto by mhitza on Friday December 05, 2025 @10:23AM (#46162484)
This looks like any other git arcane incantation. If this is a common pattern and jj aims to make things easier, should probably be part of the core commands, no?
Re:Stacked Diffs with git rebase —onto by steveklabnik on Friday December 05, 2025 @05:37PM (#46168320)
It's something that makes a specific workflow easier, a lot of folks that use jj don't necessarily use that workflow.

That doesn't mean it couldn't be a core command someday, but given that the alias works well for people, there's not a ton of reason to make a whole new command. You configure the alias and you're off to the races.

Re:Stacked Diffs with git rebase —onto by lima on Friday December 05, 2025 @07:16AM (#46160268)
There's an experimental-advance-branches feature which helps with that!
Re:Stacked Diffs with git rebase —onto by gcr on Friday December 05, 2025 @09:03AM (#46161410)
To expand: In jj, bookmarks point to "changes," not commits. Rebases, history manipulations, etc. preserve change ID, so this "just works."
Re:Stacked Diffs with git rebase —onto by WorldMaker on Friday December 05, 2025 @11:32AM (#46163572)
`--update-refs` flag helps a lot in vanilla git. That and `--autosquash` should probably be default flags to `git rebase`. I also don't entirely trust rebase without `-i` (`--interactive`), personally. I hear there is talk about shaking up the out-of-the-box default flags in git 3, and I think rebase should especially get new defaults.
Re:Stacked Diffs with git rebase —onto by 1718627440 on Friday December 05, 2025 @04:53PM (#46167879)
I also use these flag when I have the need to, but I very much don't want them to become the default.