[英]Azure DevOps - Pull Request Git "Next steps: Manually resolve these conflicts and push new changes to the source branch."
您必須在 PC 上執行以下操作
在分支dev
$ git pull --no-rebase origin master
- 這將創建一個合並提交,您將必須解決在 dev 和 master 上更改的文件中的沖突。 git status
將顯示具有沖突更改的文件列表。
解決沖突后,提交所有更改並推送您的分支。 之后,您應該能夠完成 PR。
僅供參考: --no-rebase確保合並完成,即使拉取行為被覆蓋為默認變基。
由於您需要在dev
分支上保留文件版本(在目標分支master
中更改文件時保留源分支),因此您應該在master
分支上進行更改以解決沖突文件,並確保您有權將更改推送到master
分支。
您可以使用以下選項:
在您的本地倉庫中,您可以執行以下命令將dev
合並到master
分支,同時將沖突文件版本保留為dev
分支:
git checkout master
git merge dev -X theirs
git push origin master
在您創建的現有拉取請求中,它將顯示分支已合並。 所以你可以放棄拉取請求。
您可以使用以下命令來解決master
分支中的沖突:
# In yout local repo
git checkout master
git checkout dev -- .
git commit -m 'replace master branch version by dev for the conflict files'
git push origin master
如果新提交推送到目標分支(主分支),則現有拉取請求中的更改不會更新。 並且您可以找到類似的報告Pull request diff does not update when a commit from PR is combined to the target via another branch 。
這意味着,網頁中的拉取請求仍然顯示沖突。 您應該放棄現有的拉取請求並重新激活(或創建一個新的)以將 dev 合並到 master 分支。
我不得不做一個rebase
。 必須遍歷所有提交並應用我的更改 - 它們非常廣泛,重命名命名空間和方法名稱等。然后讓我繼續在 Azure DevOps 門戶中執行Pull Request
。 實際上,我可以只刷新現有Pull Request
的更改,自動合並沖突就解決了。
合並代碼並沒有解決問題,只有rebase
有效。
我在功能分支上發生了合並沖突。
1. switched to the development branch and I completed a pull getting the current code base
2. git pull --no-rebase origin /feature/2
3. from team resolved the merge conflict by manually selecting code between
the conflicting file then pressing "accept merge"
4. push the changes to the git repository
5. complete a pull request into development
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.