That particular case can be solved much easier by rebasing outer-most branch with `--update-refs` flag.
Stacked Diffs with git rebase —onto
31–40 of 210 posts
Re: Stacked Diffs with git rebase —onto
#32Even if `--update-refs` didn't exist, my experience is that git can identify duplicate commits produced by rebase, and knows to skip them when rebasing the same commits to the same place again. Am I imagining that?
Re: Stacked Diffs with git rebase —onto
#33Earlier quoted context omitted.
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.
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
#34I think ‘git rebase —-update-refs’ is the better way to go for this scenario
Re: Stacked Diffs with git rebase —onto
#35I think ‘git rebase —-update-refs’ is the better way to go for this scenario
Running a git command on one branch and multiple branches being affected is really unusual for me! This really does look like it is designed for just this problem, though. Simple overview: https://blog.hot-coffee.dev/en/blog/git_update_refs/
Re: Stacked Diffs with git rebase —onto
#36Even if `--update-refs` didn't exist, my experience is that git can identify duplicate commits produced by rebase, and knows to skip them when rebasing the same commits to the same place again. Am I imagining that?
Re: Stacked Diffs with git rebase —onto
#37You get a nicer, significantly simpler interface. You don’t need any tricks. You don’t have to google how to work yourself out of a bad state, ever. And you get near-perfect git compatibility (ie you can use jj on a shared git repo, doing all the same things, and your teammates won’t know the difference).
I’ve wondered if there is a psychological thing here: someone who spent time memorizing all the git nonsense may have some pride in that (which is earned, certainly), that introduces some mental friction in walking away???
Re: Stacked Diffs with git rebase —onto
#38Every time I see one of these nifty git tricks or workarounds I find myself wondering, “why not just use jj?” You get a nicer, significantly simpler interface. You don’t need any tricks. You don’t have to google how to work yourself out of a bad state, ever. And you get near-perfect git compatibility (ie you can use jj on a shared git repo, doing all the same things, and your teammates won’t know the difference). I’v…
Re: Stacked Diffs with git rebase —onto
#39I think ‘git rebase —-update-refs’ is the better way to go for this scenario
Re: Stacked Diffs with git rebase —onto
#40I think ‘git rebase —-update-refs’ is the better way to go for this scenario
Is there any good guide on how to solve the issue which OP solves?
https://andrewlock.net/working-with-stacked-branches-in-git-...
Another commenter posted this link which was a bit more succinct
https://blog.hot-coffee.dev/en/blog/git_update_refs/
There isn’t much to it though, you just go to the branch and run git rebase with the update refs flag.