我遇到了一個問題,從 Main 分支創建了一個 Feature 分支,并且在合并到 Test 分支時發生沖突。如何在不將測驗分支合并到功能分支(這將導致測驗分支隨后被合并到主分支)或直接將功能分支合并到測驗分支而忽略拉取請求的情況下解決此沖突?
uj5u.com熱心網友回復:
您可以創建“集成”、“沖突解決”或“功能測驗”分支。但請注意,這意味著與最終在主分支中的代碼相比,您的測驗分支中(合并后)將有不同的代碼。
git checkout -b feature-test feature
git merge test
# resolve conflicts
# commit conflict resolution (will contain changes from test _and_ feature)
# run your tests
# ...
# if everything successful, merge your original, still-unchanged feature branch
git checkout main
git merge feature
具有沖突解決方案的提交將僅存在于“功能測驗”中。
您還可以切換分支合并的順序(測驗到功能與功能到測驗):
git checkout -b feature-test test
git merge feature
# optional: fast-forward test to include the conflict resolution: git push . HEAD:test
# resolve conflicts
# commit conflict resolution (will contain changes from test _and_ feature)
# run your tests
# ...
# if everything successful, merge your original, still-unchanged feature branch
git checkout main
git merge feature
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/536301.html
標籤:混帐
