Code

Merge branch 'sp/describe-lwtag'
[git.git] / Documentation / git-checkout.txt
index be54a0299fb2b6849993aa27d18c829ce91e7e00..168333a588e0828d2d14687774fd41cc57f43721 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git checkout' [-q] [-f] [--track | --no-track] [-b <new_branch> [-l]] [-m] [<branch>]
-'git checkout' [<tree-ish>] [--] <paths>...
+'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
 
 DESCRIPTION
 -----------
@@ -27,14 +27,20 @@ the first namespace level.
 
 When <paths> are given, this command does *not* switch
 branches.  It updates the named paths in the working tree from
-the index file (i.e. it runs `git checkout-index -f -u`), or
-from a named commit.  In
-this case, the `-f` and `-b` options are meaningless and giving
+the index file, or from a named commit.  In
+this case, the `-b` options is meaningless and giving
 either of them results in an error.  <tree-ish> argument can be
 used to specify a specific tree-ish (i.e. commit, tag or tree)
 to update the index for the given paths before updating the
 working tree.
 
+The index may contain unmerged entries after a failed merge.  By
+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.  With -m, changes made to the working tree
+file can be discarded to recreate the original conflicted merge result.
 
 OPTIONS
 -------
@@ -42,8 +48,17 @@ OPTIONS
        Quiet, suppress feedback messages.
 
 -f::
-       Proceed even if the index or the working tree differs
-       from HEAD.  This is used to throw away local changes.
+       When switching branches, proceed even if the index or the
+       working tree differs from HEAD.  This is used to throw away
+       local changes.
++
+When checking out paths from the index, do not fail upon unmerged
+entries; instead, unmerged entries are ignored.
+
+--ours::
+--theirs::
+       When checking out paths from the index, check out stage #2
+       ('ours') or #3 ('theirs') for unmerged paths.
 
 -b::
        Create a new branch named <new_branch> and start it at
@@ -73,7 +88,7 @@ This would tell us to use "hack" as the local branch when branching
 off of "origin/hack" (or "remotes/origin/hack", or even
 "refs/remotes/origin/hack").  If the given name has no slash, or the above
 guessing results in an empty name, the guessing is aborted.  You can
-exlicitly give a name with '-b' in such a case.
+explicitly give a name with '-b' in such a case.
 
 --no-track::
        Ignore the branch.autosetupmerge configuration variable.
@@ -84,7 +99,9 @@ exlicitly give a name with '-b' in such a case.
        based sha1 expressions such as "<branchname>@\{yesterday}".
 
 -m::
-       If you have local modifications to one or more files that
+--merge::
+       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.
@@ -96,6 +113,16 @@ 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
+the conflicted merge in the specified paths.
+
+--conflict=<style>::
+       The same as --merge option above, but changes the way the
+       conflicting hunks are presented, overriding the
+       merge.conflictstyle configuration variable.  Possible values are
+       "merge" (default) and "diff3" (in addition to what is shown by
+       "merge" style, shows the original contents).
 
 <new_branch>::
        Name for the new branch.