Get the latest tech news

Working with stacked branches in Git is easier with –update-refs (2022)


In this post I discuss how to use the new Git rebasing feature, --update-refs, and how it makes working with stacked branches/PRs easier.

Creating separate branches and PRs for each unit of functionality makes it easier for people to consume and follow the "story" of the commits. There's a lot of finicky rebase commands to run there, you have to get the different "base" and--onto references right (they're different for each branch), and so it's (understandably) hard to convince people that this is a worthwhile endeavour. Using the approach from the previous section, I would need to checkout part-1, work out how to rebase it correctly onto dev and then repeat for each branch in the stack.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Git

Git

Photo of refs

refs

Photo of stacked branches

stacked branches

Related news:

News photo

Git 2.46-rc0 Continues Preparations For Switching To SHA256 By Default WIth Git 3.0

News photo

Things I know about Git commits

News photo

Getting Your DBA Teams Scripts into Git