I have a branch called demo which I need to merge with master branch. I can get the desired result with following commands:
git pull or
I had a similar issue, where I needed to effectively replace any file that had changes / conflicts with a different branch.
The solution I found was to use git merge -s ours branch.
Note that the option is -s and not -X. -s denotes the use of ours as a top level merge strategy, -X would be applying the ours option to the recursive merge strategy, which is not what I (or we) want in this case.
Steps, where oldbranch is the branch you want to overwrite with newbranch.
git checkout newbranch checks out the branch you want to keepgit merge -s ours oldbranch merges in the old branch, but keeps all of our files.git checkout oldbranch checks out the branch that you want to overwriteget merge newbranch merges in the new branch, overwriting the old branch