git - how to exclude files from merging

后端 未结 5 1025
萌比男神i
萌比男神i 2020-12-28 19:28

I\'m trying to keep 2 projects of website in one repository. This websites are mainly the same except template (html,css) files and few config files. The main site (which is

5条回答
  •  梦毁少年i
    2020-12-28 20:29

    In each of your branches, add file .gitattributes in root.

    For each branch, specified the files to be ignored at merging like this:

    filename merge=ours
    

    and dont forget to activate the driver for that:

    git config --global merge.ours.driver true
    

    Try the merging, you'll see that files specified in .gitattributes in each branches will be untouched while merging happen.

提交回复
热议问题