Earlier quoted context omitted.
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.
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.
Stacked Diffs with git rebase —onto
51–60 of 210 posts
Re: Stacked Diffs with git rebase —onto
#52I've settled on a workflow that reverses the situation. I simply commit all my work to the main branch and cherry pick commits into temporary feature branches only when submitting PRs. This way I only need to worry about maintaining a single consistent lineage of commits. I've been using this workflow for about a year now and find it to be much easier than juggling and rebasing feature branches. In case anyone's inte…
Re: Stacked Diffs with git rebase —onto
#53I've settled on a workflow that reverses the situation. I simply commit all my work to the main branch and cherry pick commits into temporary feature branches only when submitting PRs. This way I only need to worry about maintaining a single consistent lineage of commits. I've been using this workflow for about a year now and find it to be much easier than juggling and rebasing feature branches. In case anyone's inte…
You might like Jujutsu – you commit without being on any branch and then later you can decide where and how you put things onto branches.
Re: Stacked Diffs with git rebase —onto
#54I usually just `git rebase origin/main -i` after the base branch has been merged there, and this means I need to explicitly drop the merged commits, but I can inspect what's happening.
Re: Stacked Diffs with git rebase —onto
#55Earlier quoted context omitted.
You don’t really need docs as --update-refs does what the OP does automatically instead of manually like the OP does.
How? I tried recreating the scenario from the article (the section "First rebase –onto") and ran the first rebase with "--update-refs": $ git checkout feature-1 $ git rebase --update-refs main Successfully rebased and updated refs/heads/feature-1. Updated the following refs with --update-refs: refs/heads/feature-2-base But all it did was update feature-2-base. It still left feature-2 pointing to the old commits. So I…
Second, you run it on the outermost branch: feature 2. It updates all refs in the chain.
Re: Stacked Diffs with git rebase —onto
#56Earlier quoted context omitted.
You don’t really need docs as --update-refs does what the OP does automatically instead of manually like the OP does.
How? I tried recreating the scenario from the article (the section "First rebase –onto") and ran the first rebase with "--update-refs": $ git checkout feature-1 $ git rebase --update-refs main Successfully rebased and updated refs/heads/feature-1. Updated the following refs with --update-refs: refs/heads/feature-2-base But all it did was update feature-2-base. It still left feature-2 pointing to the old commits. So I…
$ git rebase --update-refs main feature-2Re: Stacked Diffs with git rebase —onto
#57This marker branch step feels like a workaround to a missing capability. It's something I can easily see one forgetting especially if they haven't been doing stacked diff workflows regularly.
The capability is there. Just use git rebase --update-refs ...
Re: Stacked Diffs with git rebase —onto
#58Is there any reason besides merge commits ending up in history to not do this with merges instead? ie merge main into feature-1, then feature-1 into feature-2. Sounds like using --update-refs would let you do all that in a single operation, but you still need to force-push and don't maintain an explicit merge/conflict resolution history, both of which could be considered sub-optimal for collaborative scenarios.
Re: Stacked Diffs with git rebase —onto
#59Every 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…
For me, the answer is stgit. https://stacked-git.github.io/
Re: Stacked Diffs with git rebase —onto
#60That particular case can be solved much easier by rebasing outer-most branch with `--update-refs` flag.
I used to dutifully read release notes for every git release, but stopped at some point. Apparently that point was more than three years ago.