checkout -m: recreate merge when checking out of unmerged index
This teaches git-checkout to recreate a merge out of unmerged
index entries while resolving conflicts.
With this patch, checking out an unmerged path from the index
now have the following possibilities:
* Without any option, an attempt to checkout an unmerged path
will atomically fail (i.e. no other cleanly-merged paths are
checked out either);
* With "-f", other cleanly-merged paths are checked out, and
unmerged paths are ignored;
* With "--ours" or "--theirs, the contents from the specified
stage is checked out;
* With "-m" (we should add "--merge" as synonym), the 3-way merge
is recreated from the staged object names and checked out.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
@ -35,7 +35,8 @@ default, if you try to check out such an entry from the index, the
@@ -35,7 +35,8 @@ default, if you try to check out such an entry from the index, the
checkout operation will fail and nothing will be checked out.
Using -f will ignore these unmerged entries. The contents from a
specific side of the merge can be checked out of the index by
using --ours or --theirs.
using --ours or --theirs. With -m, changes made to the working tree
file can be discarded to recreate the original conflicted merge result.
OPTIONS
-------
@ -83,7 +84,8 @@ entries; instead, unmerged entries are ignored.
@@ -83,7 +84,8 @@ entries; instead, unmerged entries are ignored.
based sha1 expressions such as "<branchname>@\{yesterday}".
-m::
If you have local modifications to one or more files that
When switching branches,
if you have local modifications to one or more files that
are different between the current branch and the branch to
which you are switching, the command refuses to switch
branches in order to preserve your modifications in context.
@ -95,6 +97,9 @@ When a merge conflict happens, the index entries for conflicting
@@ -95,6 +97,9 @@ When a merge conflict happens, the index entries for conflicting
paths are left unmerged, and you need to resolve the conflicts
and mark the resolved paths with `git add` (or `git rm` if the merge
should result in deletion of the path).
+
When checking out paths from the index, this option lets you recreate
die("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?", argv[0]);