While working on my feature branches, I constantly re-order and squash them with git rebase -i
to keep a cleaner version of my history. Sometimes I work on several features that depend on each other (the rules in my team are to make PRs as small as possible, so one atomic chunk of a larger feature usually becomes a feature branch of its own). As a result of this workflow, I usually end up re-pointing branches manually after rebasing them. Is there a way to automatically move these pointers to where they should land?
So, for instance, in this graph:
5bab4818e (HEAD -> cell-toggle-comp) Added cell-toggle component
d55cab881 (toggle-comp) Toggle: Added honey traceability comment
4240f0ac3 Made Toggle a named export and replaced references to obsolete <ui> alias
90a0b2452 Refactored Switch instances to toggle
e15c758a0 Updated Switch component to latest specs (and renamed things to match design lingo)
d53090e93 (fix-switch-reference) Fixed Switch reference that was being imported from React Native instead of src/components
4a214cb72 (cell-text-selection-comp) Added CellTextSelection ui component
cef3b5716 (origin/master, origin/HEAD, master) Merge pull request #1630 from repo
Let's say that I want to swap commits e15c758a0
and d53090e93
, but I want the fix-switch-reference
branch to move along with its commit. Is there a way to do that automatically? Or do I have to move the commits and then point the branch to the new hash by hand?