From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erick Mattos Subject: [PATCH v3] git checkout -b: unparent the new branch with -o Date: Tue, 16 Mar 2010 15:19:44 -0300 Message-ID: <1268763584-14164-1-git-send-email-erick.mattos@gmail.com> Cc: git@vger.kernel.org, Erick Mattos To: Junio C Hamano X-From: git-owner@vger.kernel.org Tue Mar 16 19:21:40 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NrbOc-00066g-VE for gcvg-git-2@lo.gmane.org; Tue, 16 Mar 2010 19:21:39 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755528Ab0CPSVe (ORCPT ); Tue, 16 Mar 2010 14:21:34 -0400 Received: from mail-qy0-f179.google.com ([209.85.221.179]:52245 "EHLO mail-qy0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790Ab0CPSVd (ORCPT ); Tue, 16 Mar 2010 14:21:33 -0400 Received: by qyk9 with SMTP id 9so92922qyk.1 for ; Tue, 16 Mar 2010 11:21:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=QfUvheC9P41ghw5rVhqQqfeifD4IuGlnJe2rTxRnM1k=; b=M66RzsDxhwtq0B6W51/lUswU0qJeylifVRoyxFczo23xbhGRDvAXfiu/J7MUYPLVkM cXywGQc6++zEW1ibZN5UScSzKeFZb7zInCvVvx4l9mx2hL2IAs9X4duFJjp/LlF+JfaT Rijs15TpQMrcUYcOQqvE4fhFiVUY0cab7DrAs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=o2mrqMgxE6LWt21gIQT9k0hrVquWOMZPH78Eol4Pl5RJbOq3u4gInQ90YR1V12fOdR 8feV+LLoIPzMm7DWyMJlsQe+a+7LT7sCvX4YoLGRNzyFI0fbpxyRE1Ox3ypkIdVz0H5O E50IusucZRXwyjOjf3m6b+4q2kT2kjDH1cuGA= Received: by 10.224.115.81 with SMTP id h17mr610qaq.231.1268763619392; Tue, 16 Mar 2010 11:20:19 -0700 (PDT) Received: from localhost.localdomain ([187.15.111.107]) by mx.google.com with ESMTPS id 6sm3210555qwk.52.2010.03.16.11.20.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Mar 2010 11:20:18 -0700 (PDT) X-Mailer: git-send-email 1.7.0.2.274.gc8f05 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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=