]> rtime.felk.cvut.cz Git - git.git/blobdiff - Documentation/git-checkout.txt
Merge branch 'maint'
[git.git] / Documentation / git-checkout.txt
index a3a87fa7fd29973e15afb93382646ae6f89d0f61..afda5c36b5ac0061d94d706cd7a07ef8197b6b31 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git checkout' [-q] [-f] [-m] [<branch>]
-'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<start_point>]
+'git checkout' [-q] [-f] [-m] [[-b|--orphan] <new_branch>] [<start_point>]
 'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
 'git checkout' --patch [<tree-ish>] [--] [<paths>...]
 
@@ -90,6 +90,24 @@ explicitly give a name with '-b' in such a case.
        Create the new branch's reflog; see linkgit:git-branch[1] for
        details.
 
+--orphan::
+       Create a new branch named <new_branch>, unparented to any other
+       branch.  The new branch you switch to does not have any commit
+       and after the first one it will become the root of a new history
+       completely unconnected from all the other branches.
++
+When you use "--orphan", the index and the working tree are kept intact.
+This allows you to start a new history that records set of paths similar
+to that of the start-point commit, which is useful when you want to keep
+different branches for different audiences you are working to like when
+you have an open source and commercial versions of a software, for example.
++
+If you want to start a disconnected history that records set of paths
+totally different from the original branch, you may want to first clear
+the index and the working tree, by running "git rm -rf ." from the
+top-level of the working tree, before preparing your files (by copying
+from elsewhere, extracting a tarball, etc.) in the working tree.
+
 -m::
 --merge::
        When switching branches,