0

Enhance rebase with --update-refs

Cyril Duchon-Doris 4 days ago 0

Hello,

Summary : introduce ability to perform rebase with --update-ref, and enhance UI around it


Use case solved :
- you work on a big feature, and you have to split your work into multiple PRs. You have therefore many branches and Pull requests based on each other (also called chained PR, PR trains).
- You are working with a git flow where you occasionally need to rebase/squash/force-push to integrate fixes in your feature branches before merging them


The problem : 
Suppose you need to fix a bug on the very first branch with a rebase on the original commit, you'd have to also rebase all other branches. --update-ref allows to do this once

Additional enhancements possible : the smartgit UI could tell you which other branches had their refs updated, and suggest to push them as well. It is unsure if this is always the desired behavior (for example If you are working with a teammate on this PR-train, and you need to better co-ordinate) 

Original message : 

I just discovered this feature from git called --update ref released actually a couple years ago in 2022

https://github.blog/open-source/git/highlights-from-git-2-38/#rebase-dependent-branches-with-update-refs

https://medium.com/@bruce.ho98/a-better-way-to-rebase-stacked-prs-aa9b4dc600f1

I was wondering if this is something that could be introduced to Smartgit ? It could be either silently (just applying the parameter) or even better, having some UI feedback about the list of other updated branches, along with support regarding pushing all those branches.

It could be a killer feature for teams committed to making small PRs and often needing to cascade them.

Notes : there are some tools that seem to provide similar behavior to rebase --update-refs available online like https://github.com/realyze/pr-train

Best,

Cyril

Missing Git feature Improve Git commands Repository Management