一個最簡單的做法,通過添加.gitattributes文件來完成
1 在要被合並的分支中設置 git config --global merge.ours.driver true設置git配置項merge不合並的具體分支上的內容的;
2 在要被merge
的分支上創建.gitattributes
文件,並且在文件中置頂不merge
的文件名
detail.txt merge=ours
git add .gitattributes git commit -m '...' git push
3 回到要合並到的分支master
,執行merge
:
git merge dev