1

How can I preview the merge conflicts before actually trying to merge? Git diff is great, but it shows too much. I only want to view the conflicts.

There are many times I don't understand why particular files would have a conflict and I would like to reason about my changes before merging branches.

Breedly
  • 12,838
  • 13
  • 59
  • 83

1 Answers1

3

This answer may be trivial/obvious, but you can just go ahead and do the merge:

# from your target branch
git merge feature

If you hit some nasty merge conflicts and want to bail out, then just use:

git merge --abort

If the merge actually completes without conflicts, but you don't want to keep the merge just yet, then you can reset:

git reset --hard HEAD~1

Note: This answer assumes that you are doing all of this locally, and not on the remote Git server. If you are using something like Bitbucket or GitHub, then there should already be a feature which does roughly what you want. You may create a pull request, and if there are impassable merge conflicts, the UI would alert you to this.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360