在互動式 git rebase 期間是否有再次回傳的技巧?讓我們這樣說:
git init
for c in a b c; do
touch $c && git add $c && git commit -m $c
done
現在假設我開始了一些像這樣的互動式變基:
git rebase -i --root
# p 5e2df3f a
# e b87116d b
# p a55558f c
并且,b根據我的喜好進行編輯后- 也許通過在 a 之后將其拆分為兩次提交git reset HEAD^ -p,我最終得到:
git commit --amend
touch b2 && git add b2 git commit -m "b''"
git log --oneline
# a5f42cc (HEAD) b''
# 5446996 b'
# 5e2df3f a
我現在如何跳回去而不必先完成 rebase 直到最后?即在這個階段我會看到:
git rebase --edit-todo
# p a55558f c
但是如果我在新5446996 b'提交中犯了錯誤怎么辦?如果我意識到我必須修改其他一些東西,5e2df3f a那最初是我的 rebase 編輯待辦事項的開始?
我可以以某種方式跳回去 - 就像嵌套git rebase -i(不允許直接)?還是有其他方法可以實作這一目標?
我明確地做不希望要完成的底墊我在,然后再重新啟動它。
謝謝!
uj5u.com熱心網友回復:
您只需手動重播嵌套 rebase 會做什么。也就是說,您可以回傳提交并修復它:
git checkout 5446996
# edit
git commit -a --amend
然后你挑選剩余的提交:
git cherry-pick 5446996..a5f42cc
如有必要,修復沖突和git cherry-pick --continue.
然后用git rebase --continue.
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/332850.html
標籤:混帐
上一篇:在Windows上使用url.<base>.insteadOf時出現無效密鑰錯誤
下一篇:用戶將如何從瀏覽器使用GIT
