Reputation: 2899
When I merge branches I am trying to ignore web.config
between each branch because each branch have different configuration in web.config.
Some reason, it is not working.
Am I missing something?
This is what i have so far.
* text=auto
Web.config merge=ours
.gitignore
.gitattributes
project
|____directory
|____directory2
|_____Web.config
I also set merge.ours.driver to true:
git config --global merge.ours.driver true
Upvotes: 1
Views: 892
Reputation: 1323165
today I added a few new files and change some files but when i merge locally, this is not working.
A merge strategy like merge=ours
only applies on specific files when they have conflicts. If you change a file only in one branch, then merge that branch, there is no conflict (ie, no concurrent modification).
In other words, merge=ours
is not the right solution for your case (whether or not you are using Visual Studio 2015).
I would rather:
web.config.master
, web.config.mybranch
, ...), in which you can modify each file as you wantweb.config
.web.config
copied file would remain ignored and private. Your smudge
script can determine the name of the checked out branch with:
branch=$(git rev-parse --symbolic --abbrev-ref HEAD)
Upvotes: 1
Reputation: 141946
You almost there, you missed something small - to mark the exact file that you wish to ignore. you have it with capital letters or if its right and nested it should be with **/web.config
echo 'web.config merge=ours' >> .gitattributes
echo '**/web.config merge=ours' >> .gitattributes
Do it and it will work.
Upvotes: 1