[英]git conflict with merge but not with rebase
我有一個沖突問題,它只發生在 rebase 上,而不是與 GitHub UI 合並。
它發生在嘗試將當前分支重置為上一個提交之后,通過執行以下命令,然后使用 GitHub 將 PR 重新設置為 master:
git reset --hard HEAD~1
git push origin <myBranch> -f
我試圖將當前的 master 和 merge master 合並到我的分支中,但它不起作用。
我不確定為什么沖突發生在 rebase 而不是合並。
我假設您進行了提交,並希望將您的分支重新設置為最新的 master,並將您的提交放在頂部。
第 1 步:使用上游 master 更新本地 master
git pull upstream master
第 2 步:結帳到myBranch
git checkout myBranch
第 3 步:使用本地主服務器重新設置myBranch
的基礎
git rebase master
如果您現在遇到合並沖突,這意味着存在與myBranch
中的更改相沖突的更改。
在您正在使用的編輯器的幫助下解決沖突,然后
git rebase --continue
現在,您的myBranch
已更新為最新的上游 master。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.