git merge resolve conflicts by always choosing merged branch

Snippet

There are times when a branch has diverged so far from master or itself that doing a fetch-merge is just impossible without conflicts. Those with changing binary files or gigantic files? The worst.

$ git reset --hard HEAD
HEAD is now at 82a18be this is my last change, no really
$ git pull origin my_branch
From github.com:kitt/this-is-a-fake-repo
 * branch             my_branch -> FETCH_HEAD
Auto-merging some-project/project.xcodeproj/project.pbxproj
CONFLICT (content): Merge conflict in some-project/project.xcodeproj/project.pbxproj
Auto-merging some-project.xcworkspace/contents.xcworkspacedata
Automatic merge failed; fix conflicts and then commit the result.

Solution, just take what the branch has, don't try to merge in changes, in case of conflict.

git merge -s recursive -X theirs branch-name

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.