From: Erick Mattos Date: Thu, 18 Mar 2010 16:09:39 GMT Subject: [PATCH] git checkout: create unparented branch by --orphan Message-ID: <1268928579-11660-1-git-send-email-erick.mattos@gmail.com> Similar to -b, --orphan creates a new branch, but it starts without any commit. After running "git checkout --orphan newbranch", you are on a new branch "newbranch", and the first commit you create from this state will start a new history without any ancestry. "git checkout --orphan" keeps the index and the working tree files intact in order to make it convenient for creating a new history whose trees resemble the ones from the original branch. When creating a branch whose trees have no resemblance to the ones from the original branch, it may be easier to start work on the new branch by untracking and removing all working tree files that came from the original branch, by running a 'git rm -rf .' immediately after running "checkout --orphan". Signed-off-by: Erick Mattos --- Complete rewrite of --orphan functionality to fit it in the new design goals set by Junio. Now --orphan is not anymore an option of -b. It is an alternative to it. Junio: I ask you to reconsider only the giving of the "short-and-sweet" -o from beginning because of the new design. As it is now an alternative to -b, doing similar stuff, I think it will be nice if they look similar too. So the it will be [[-b|-o] ] not [[-b|--orphan] ]. Please ignore it if you can preview future options to checkout that could take the rest of the 21 remaining letters and 6 digits. Regards Documentation/git-checkout.txt | 21 +++++++++++++++- builtin/checkout.c | 19 +++++++++++++- t/t2017-checkout-orphan.sh | 53 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 3 deletions(-) create mode 100755 t/t2017-checkout-orphan.sh diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 37c1810..18df834 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'git checkout' [-q] [-f] [-m] [] -'git checkout' [-q] [-f] [-m] [-b ] [] +'git checkout' [-q] [-f] [-m] [[-b|--orphan] ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=