Git 2.38 introduced the --update-refs
flag to the rebase command. If you have a chain of branches, it will update all the branches in the chain. I've found this incredibly useful when breaking a large PR down into more easily reviewed PRs.
However, after git rebase --update-refs dev
, I need to push all the refs to GitHub to update the PRs. This requires a set of git checkout branch1 && git push --force-with-lease && git checkout branch2 && git push --force-with-lease && ...
.
Is there a way built into git to handle this automatically? I basically want to push --force-with-lease
automatically for any branches updated during a rebase --update-refs
.