I have three branches in the repository.
master
slave 1
slave 2
there is one package.json
file. It should be different in each of the branches. But if I run the git merge master
command. These two branches merge into one. How to exclude package.json
from merging branches so that each branch has its own version?
add:
I have a sequence
git checkout slave 1 && git merge -Xtheirs --no-edit master && git push && git checkout master
There is no automatic way to tell git to avoid merging changes on a file. You can ask to check out the file from HEAD before finishing the merge:
git merge other-branch --no-commit
git checkout HEAD -- package.json # get the file back
git commit -m "Now we finish the merge"