From: Erick Mattos Date: Tue, 16 Mar 2010 18:19:44 GMT Subject: [PATCH v3] git checkout -b: unparent the new branch with -o Message-ID: <1268763584-14164-1-git-send-email-erick.mattos@gmail.com> Sometimes it is interesting to start a new unparented branch in an existing repository. The new -o/--orphan is intended to solve this situation allowing the creation of a new branch unparented to any other. After the 'checkout -o -b' the new branch is not saved until committed. Before committing you should 'git rm -rf' anything which is not going to take part in the new branch and change the work tree and index the way you want it to be since they remain untouched as before checkout command. There are two potential work flows where this feature is most useful: (1) "mostly common paths" work flow; (2) "no common paths" work flow; Signed-off-by: Erick Mattos --- Major rewrite to conform to Junio's demands. Now after checkout to the new unparented branch, the index and the work tree remain unchanged. Documentation/git-checkout.txt | 13 ++++++++++ builtin/checkout.c | 10 ++++++- t/t2017-checkout-orphan.sh | 49 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100755 t/t2017-checkout-orphan.sh diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 37c1810..92562ce 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -9,6 +9,7 @@ SYNOPSIS -------- [verse] 'git checkout' [-q] [-f] [-m] [] +'git checkout' [-q] [-f] [-m] [-b [-o]] 'git checkout' [-q] [-f] [-m] [-b ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=