How to resolve ALL conflicts using HEAD, with any mergetool

git merge -Xours origin/master

will do a merge with origin/master (the same thing that git pull origin master does) and will resolve any conflicts by taking the versions from your local branch.

If you’re already part-way through the bad merge, you can reset everything to the head first with git reset --hard HEAD.

In that case, you should do

git reset --hard HEAD
git merge -Xours origin/master

And that should fix your problem!

(also worth mentioning, -Xtheirs will do the same thing, but take the upstream version in any conflicts.)


Also, most likely the conflicts are because the upstream version is using windows-style line endings, and whatever program you edited the files in on your local machine is using mac-style or linux-style line endings.

There are options you can set in git to always commit windows-style or linux-style line endings, but always checkout mac-style or linux-style in your working directory.

See this link for more info:
https://help.github.com/articles/dealing-with-line-endings

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)