All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: "Michael Witten" <mfwitten@gmail.com>,
	"Carlos Martín Nieto" <cmn@elego.de>,
	vra5107 <venkatram.akkineni@gmail.com>,
	"Michael J Gruber" <git@drmicha.warpmail.net>,
	"Matthieu Moy" <Matthieu.Moy@grenoble-inp.fr>,
	"Eric Raible" <raible@nextest.com>,
	"Philip Oakley" <philipoakley@iee.org>,
	"Jeff King" <peff@peff.net>, "Jay Soffian" <jaysoffian@gmail.com>
Subject: [PATCH] Documentation/git-checkout.txt: Explain --orphan without introducing an undefined "orphan branch"
Date: Thu, 29 Sep 2011 11:59:07 -0700	[thread overview]
Message-ID: <7v39fftbt0.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vmxdnte0j.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 29 Sep 2011 11:11:24 -0700")

The name of the `--orphan` option to `checkout` is meant to express that
the next commit made on the branch does not have any parent (specifically,
it will not be a child of the current nor start_point commit), but the
glossary calls such a commit 'a root commit'. The explanation however used
an undefined term 'orphan branch', adding mental burden to the first time
readers.

Reword the description to clarify what it does without introducing a new
term, stressing that it is similar to what happens to the "master' branch
in a brand new repository created by `git init`. Also explain that it is
OK to tweak the index and the working tree before creating a commit.

Also mildly discourage the users from using this to originate a new root
commit that tracks material that is unrelated to the main branches in a
single repository with a working tree, and hint a better way of starting
an unrelated history, as it seems to be a common abuse of this option.

We may want to give a synonym `--new-root` to this option and eventually
deprecate the `--orphan` option, as "parent vs orphan" might not
immediately "click" to non native speakers of English (like myself), but
that is a separate topic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * I am inclined to suggest doing something like this instead.

 Documentation/git-checkout.txt |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index c0a96e6..63d164e 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -125,16 +125,16 @@ explicitly give a name with '-b' in such a case.
 	below for details.
 
 --orphan::
-	Create a new 'orphan' branch, named <new_branch>, started from
-	<start_point> and switch to it.  The first commit made on this
-	new branch will have no parents and it will be the root of a new
-	history totally disconnected from all the other branches and
-	commits.
+	Adjust the working tree and the index as if you checked out the
+	<start_point>. The next commit begins a history that is not connected
+	to any other branches, as if you ran `git init` in a new repository,
+	except that the commit will be made on the <new_branch> branch, not on
+	the "master" branch.
 +
-The index and the working tree are adjusted as if you had previously run
-"git checkout <start_point>".  This allows you to start a new history
-that records a set of paths similar to <start_point> by easily running
-"git commit -a" to make the root commit.
+Running "git commit" immediately after doing this will record a root commit
+with a tree that is the same as the tree of the <start_point>. You may
+manipulate the index before creating the commit to record a tree that is
+different from that of the <start_point>.
 +
 This can be useful when you want to publish the tree from a commit
 without exposing its full history. You might want to do this to publish
@@ -143,11 +143,13 @@ whose full history contains proprietary or otherwise encumbered bits of
 code.
 +
 If you want to start a disconnected history that records a set of paths
-that is totally different from the one of <start_point>, then you should
-clear the index and the working tree right after creating the orphan
-branch by running "git rm -rf ." from the top level of the working tree.
+that is totally different from the one of <start_point>, you could
+clear the index and the working tree right after "git checkout --orphan"
+by running "git rm -rf ." from the top level of the working tree.
 Afterwards you will be ready to prepare your new files, repopulating the
 working tree, by copying them from elsewhere, extracting a tarball, etc.
+However, such a use case to keep track of a history that is unrelated to
+the main project is better done by starting a new, separate repository.
 
 -m::
 --merge::

  parent reply	other threads:[~2011-09-29 19:00 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-25 14:15 Can a git changeset be created with no parent vra5107
2011-09-25 14:33 ` Andreas Ericsson
2011-09-25 14:33 ` Carlos Martín Nieto
2011-09-26 19:25   ` Junio C Hamano
2011-09-26 21:41     ` Carlos Martín Nieto
2011-09-27 14:43       ` [PATCH] Docs: git checkout --orphan: `root commit' and `branch head' Michael Witten
2011-09-27 15:02         ` Matthieu Moy
2011-09-27 15:46           ` [PATCH v2] " Michael Witten
2011-09-27 16:01             ` Matthieu Moy
2011-09-27 16:13               ` Michael Witten
2011-09-27 16:53                 ` Matthieu Moy
2011-09-27 17:09                   ` Michael Witten
2011-09-27 20:59               ` Philip Oakley
2011-09-28 16:23                 ` [PATCH v3] " Michael Witten
2011-09-28 20:34                   ` Junio C Hamano
2011-09-29 15:52                     ` Michael Witten
2011-09-29 15:44                       ` [PATCH v4] Docs: git checkout --orphan: Copyedit, and s/root commit/orphan branch/ Michael Witten
2011-09-29 16:44                         ` Michael Witten
2011-09-29 20:05                         ` Philip Oakley
2011-09-29 18:11                       ` In favor of "git commit --no-parent" Junio C Hamano
2011-09-29 18:52                         ` Michael Witten
2011-09-29 18:59                         ` Junio C Hamano [this message]
2011-09-29 19:02                           ` [PATCH] Documentation/git-checkout.txt: Explain --orphan without introducing an undefined "orphan branch" Michael Witten
2011-09-29 21:02                         ` In favor of "git commit --no-parent" Phil Hord
2011-09-29 21:28                           ` Michael Witten
2011-09-29 21:50                             ` Phil Hord
2011-09-29 22:01                               ` Michael Witten
     [not found]                         ` <CABURp0q8YhTS-GDYOANEa19P-V2wf_EUTo=RHqnhDB619w=y-w@mail.gmail.com>
     [not found]                           ` <7vd3ejrqin.fsf@alter.siamese.dyndns.org>
2011-09-29 21:54                             ` Junio C Hamano
2011-09-29 22:07                               ` Phil Hord
2011-09-29 22:29                                 ` Michael Witten
2011-09-29 22:32                                   ` Michael Witten
2011-09-29 23:08                                 ` Junio C Hamano
2011-09-30  0:51                                   ` Michael Witten
2011-09-30  2:28                                     ` Junio C Hamano
2011-09-29 22:07                               ` Michael Witten
2011-09-27 15:49         ` [PATCH] Docs: git checkout --orphan: `root commit' and `branch head' Michael J Gruber
2011-09-27 16:02           ` Michael Witten
2011-09-27 17:25             ` Junio C Hamano
2011-09-27 17:50               ` Michael Witten
2011-09-27 20:34               ` Eric Raible
2011-09-27 21:31                 ` Philip Oakley
2011-09-27 21:42                   ` Jeff King
2011-09-27 23:28                     ` Michael Witten
2011-09-27 23:35                       ` Jeff King
2011-09-27 23:44                         ` Michael Witten
2011-09-28  0:32                         ` Junio C Hamano
2011-09-28 13:40                           ` Michael Witten
2011-09-28 13:45                             ` Matthieu Moy
2011-09-28 13:50                               ` Michael Witten
2011-09-28 14:09                                 ` Matthieu Moy
2011-09-28 14:35                                   ` Michael Witten
2011-09-28 14:45                                     ` Matthieu Moy
2011-09-28 15:06                                       ` Michael Witten
2011-09-28 18:17                                   ` Junio C Hamano
2011-09-28  4:04               ` Jay Soffian
2011-09-28  4:37                 ` Michael Witten
2011-09-28  8:00               ` Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v39fftbt0.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=cmn@elego.de \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian@gmail.com \
    --cc=mfwitten@gmail.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.org \
    --cc=raible@nextest.com \
    --cc=venkatram.akkineni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.