RESOLVE CONFLICTS
------------------------
After seeing a conflict, you can do two things:
* Decide not to merge. The only clean-ups you need are to reset
the index file to the `HEAD` commit to reverse 2. and to clean
up working tree changes made by 2. and 3.; `git merge --abort`
can be used for this.
* Resolve the conflicts. Git will mark the conflicts in
the working tree. Edit the files into shape and
`git add` them to the index. Use `git commit` or
`git merge --continue` to seal the deal. The latter command
checks whether there is a (interrupted) merge in progress
before calling `git commit`.
You can work through the conflict with a number of tools:
* Use a mergetool. `git mergetool` to launch a graphical
mergetool which will work through the merge with you.
* Look at the diffs. `git diff` will show a three-way diff,
highlighting changes from both the `HEAD` and `MERGE_HEAD`
versions. `git diff AUTO_MERGE` will show what changes you've
made so far to resolve textual conflicts.
* Look at the diffs from each branch. `git log --merge -p <path>`
will show diffs first for the `HEAD` version and then the
`MERGE_HEAD` version.
* Look at the originals. `git show :1:filename` shows the
common ancestor, `git show :2:filename` shows the `HEAD`
version, and `git show :3:filename` shows the `MERGE_HEAD`
version.
EXAMPLES
--------
* Merge branches `fixes` and `enhancements` on top of
the current branch, making an octopus merge:
+
------------------------------------------------
$ git merge fixes enhancements
------------------------------------------------
* Merge branch `obsolete` into the current branch, using `ours`
merge strategy:
+
------------------------------------------------
$ git merge -s ours obsolete
------------------------------------------------
* Merge branch `maint` into the current branch, but do not make
a new commit automatically:
+
------------------------------------------------
$ git merge --no-commit maint
------------------------------------------------
+
This can be used when you want to include further changes to the
merge, or want to write your own merge commit message.
+
You should refrain from abusing this option to sneak substantial
changes into a merge commit. Small fixups like bumping
release/version name would be acceptable.
include::merge-strategies.adoc[]
CONFIGURATION
-------------
`branch.<name>.mergeOptions`::
Sets default options for merging into branch _<name>_. The syntax and
supported options are the same as those of `git merge`, but option
values containing whitespace characters are currently not supported.
include::includes/cmd-config-section-rest.adoc[]
include::config/merge.adoc[]
SEE ALSO
--------
linkgit:git-fmt-merge-msg[1], linkgit:git-pull[1],
linkgit:gitattributes[5],
linkgit:git-reset[1],
linkgit:git-diff[1], linkgit:git-ls-files[1],
linkgit:git-add[1], linkgit:git-rm[1],
linkgit:git-mergetool[1]
GIT
---
Part of the linkgit:git[1] suite