From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erick Mattos Subject: [PATCH v2] git checkout -b: unparent the new branch with -o Date: Tue, 9 Mar 2010 19:28:33 -0300 Message-ID: <1268173713-5224-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 09 23:29:22 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 1Np7vU-0004XO-Br for gcvg-git-2@lo.gmane.org; Tue, 09 Mar 2010 23:29:20 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755302Ab0CIW3J (ORCPT ); Tue, 9 Mar 2010 17:29:09 -0500 Received: from qw-out-2122.google.com ([74.125.92.27]:56422 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751801Ab0CIW3H (ORCPT ); Tue, 9 Mar 2010 17:29:07 -0500 Received: by qw-out-2122.google.com with SMTP id 8so125073qwh.37 for ; Tue, 09 Mar 2010 14:29:07 -0800 (PST) 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=DOIz+AAE/uFhesqcTxBGOqC1SOU6jB1eVUUay4cOVJo=; b=DGiHCbO6Ofp/diwhVCFaHB/0ZW/MLL+HlrGaRgWfgAuMooEc91yiTMIGOL8IUx4YiJ GlKfvybZY/k6WDKtr974ocJn2lP8Yp0Suwnt4Q6A1rbHLDJi61La6KcfNMxVy3gHxXC3 pu1SkWsYEdLYrgRSyjO6+GUJN+lV/zu2CqeQQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=aowhStJqhYgDffVCk+SSyTnbimZJfuawl/RMBQD5TULq4LniJEqdMIRj9HFNr3+P4o SRQaC6lJmdBICS5kLIDFicdA894FAGZmsEc69WnucX+tAtFSFMvVmSom2ISGtY+Zy96+ zmUAriGHDtMsMEVVtxqjlOVGGaqzFoqfqwky4= Received: by 10.224.35.7 with SMTP id n7mr407048qad.279.1268173739972; Tue, 09 Mar 2010 14:28:59 -0800 (PST) Received: from localhost.localdomain ([187.15.94.32]) by mx.google.com with ESMTPS id 2sm16374336qwi.51.2010.03.09.14.28.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 09 Mar 2010 14:28:59 -0800 (PST) X-Mailer: git-send-email 1.7.0.2.164.geccf6.dirty Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Sometimes it is necessary to start up a new development branch of code intended to be merged in the near future to existing branches but which actually does not relate to them. 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 some files are added to the index and committed, exactly as if it was an initial commit. A 'git clean -df' would delete everything from the work tree making it empty for new files. Signed-off-by: Erick Mattos --- Changed the text in SYNOPSIS to correct it as noticed by Jakub Narebski. Regards Documentation/git-checkout.txt | 10 ++++++++ builtin-checkout.c | 14 +++++++++- t/t2017-checkout-orphan.sh | 50 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 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..c13ab62 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=