在功能分支上工作时,我会不断地重新排序并用git rebase -i
压缩它们,以保持历史记录的清晰。有时我会研究相互依赖的多个功能(我团队的规则是使PR尽可能小,因此较大功能的一个原子块通常成为其自身的功能分支)。由于此工作流程,我通常会在重新定基后最终手动重新指向分支。有没有一种方法可以将这些指针自动移动到它们应该降落的地方?
例如,在此图中:
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
假设我想交换提交e15c758a0
和d53090e93
,但是我希望fix-switch-reference
分支随其提交一起移动。有没有一种方法可以自动执行此操作?还是我必须先移动提交,然后用手将分支指向新的哈希?