[英]Coalesce several commits on a branch without merge conflict issues
在我的工作分支上,執行以下操作:
git reset –hard mybranch-start-commit
git checkout mybranch-end-commit . // files only of the latest commit
git add -a
git commit -m”New Message intermediate commits discarded”
瞧,我們已經將最新提交與分支的開始提交連接了,並且沒有合並沖突問題!
雖然這是我在學習實踐中獲得的解決方案,但是否有更好,更標准的方法來實現這一目標?
有沒有更好,更標准的方法來實現這一目標?
是:混合git reset
(默認情況下為git reset
)可以避免結帳狀態:
git reset mybranch-end-commit
git add -A
git commit -m ”New Message intermediate commits discarded”
它將HEAD重置並索引到mybranch-end-commit
。
您無法添加和提交。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.