How do I tell git to always select my local version for conflicted merges on a specific file?

后端 未结 3 1971
一向
一向 2020-11-21 23:58

Say I\'m collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to.

Is there any way for me

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 00:14

    We have multiple config files that we never want overwritten. However .gitignore and .gitattributes did not work in our situation. Our solution was to store the config files in a configs branch. Then, allow the files to be changed during the git merge, but immediately following the merge use the "git checkout branch -- ." to copy our config files from the configs branch after every merge. Detailed stackoverflow answer here

提交回复
热议问题