Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is active work related to teaching "git rebase" to natively support stacked branches in the Git core currently being worked on by Derrick Stolee [1].

If you "stack" your changes across multiple inter-dependent branches it looks like "git rebase" is going to learn how to update related branches using a new "update-ref" command (alongside "squash", "fixup", "exec", etc) that gets activated automatically through a "git rebase --update-refs" command-line flag and config option.

(This is from Derrick, not me)

""" This is a feature I've wanted for quite a while. When working on the sparse index topic, I created a long RFC that actually broke into three topics for full review upstream. These topics were sequential, so any feedback on an earlier one required updates to the later ones. I would work on the full feature and use interactive rebase to update the full list of commits. However, I would need to update the branches pointing to those sub-topics.

This series adds a new --update-refs option to 'git rebase' (along with a rebase.updateRefs config option) that adds 'git update-ref' commands into the TODO list. This is powered by the commit decoration machinery.

"""

This is under active development (I don't believe the topic has been merged yet) so it's still open for feedback and refinement on the git development mailing list. Thanks Derrick!

[1] https://public-inbox.org/git/pull.1247.git.1654263472.gitgit...



That sounds great! I have partly solved this issue in my autorebase tool (https://github.com/Timmmm/autorebase) - it basically rebases every branch, and fixes the commit time so that stacked branches get preserved even after a rebase just because the hashes all match properly.

That obviously doesn't work if you modify or drop any of the commits, so this option is very welcome!


That’s very interesting! I use a very simple shell script plus git rerere [1] to keep PR stacks up to date with the bottom element’s base branch.

[1] https://git-scm.com/docs/git-rerere


This would be such a great addition! It doesn’t get stacked diffs to quite native support within Git, but it’d be a very good step in that direction


Wow, this is incredible and would make myself and so many people I know super happy! This is awesome work!


Is that likely to help with permanent forks or will that still continue to be an issue?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: