We have two branches X and Y that have been branched at this point:
test.txt dir/a.txt dir/b.txt
Now branch X introduces some changes into dir/a.txt and a commit is created. Branch Y makes a commit where dir/ gets deleted.
Then we want to merge X into Y. This will create a certain kind of "deleted-changed" conflict. Is it possible to instruct git to always "use ours" when it detects this specific conflict for the specific branch (Y) and a specific set of files (dir/*) ?
preguntado el 31 de julio de 12 a las 15:07
Read the section on merge strategies in the página de manual. Puede especificar
-s ours or
-s theirs to choose to use the version from one branch or another entirely. Or you can have it prefer to resolve conflicts using one or the other using the recursive merge with either ours or theirs recursive strategies. Note these are not the same things.
In the above case, if you are on Y and you merge X with
git merge -s ours X it will produce a result with changes from branch Y.