diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-checkout.txt | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 37c1810e3f..4505eb6d84 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -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, |