解決衝突

當多人開發時會碰到修改到相同的檔案,就會發生衝突

分支衝突合併

當我們在master 進行修改,dev 分支同時也進行修改,就會有衝突 ( CONFLICT )

  • 終端機訊息

CONFLICT (content): Merge conflict in css/style.css
Automatic merge failed; fix conflicts and then commit the result.
  • 程式碼報錯

衝突圖

使用 merge 可能會有部分程式碼會 conflict 衝突:簡單的情況只要 編輯檔案處理 <<<< ===== >>>>> 即可,然後重新 add 到 staging area 並 commit

當改到相同檔案就會有衝突, 解決的方式: 就是合併完後再重新推上去一版

遠端合併衝突

當你從遠端拉回分支之後,也會有相同檔案的覆蓋問題

git pull

Last updated

Was this helpful?