Merging but overwriting changes in Git Merging but overwriting changes in Git git git

Merging but overwriting changes in Git


Add -X ours argument to your git merge command.

Say you are working in your local branch. Then you want to merge in what went in the master:

git merge -X ours master

On the other hand if you are in master and want to merge your local branch into master then @elhadi rightly says you should use theirs:

git merge -X theirs somebranch


To overwrite your stuff in your branch and take their work, you should make

git merge -X theirs {remote/branch} --> example:origin/master