From: Junio C Hamano <gitster@pobox.com>
To: Chris Johnsen <chris_johnsen@pobox.com>
Cc: Erick Mattos <erick.mattos@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH v3] git checkout: create unparented branch by --orphan
Date: Mon, 22 Mar 2010 13:19:11 -0700 [thread overview]
Message-ID: <7vljdk85z4.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <3F619EAA-288D-4310-B9C6-8121FE00E7B0@pobox.com> (Chris Johnsen's message of "Mon\, 22 Mar 2010 07\:43\:44 -0500")
Chris Johnsen <chris_johnsen@pobox.com> writes:
> --orphan::
> Create a new, 'orphan' branch named <new_branch>, and start it
> at <start_point>. The first commit made on this new branch will
> have no parents (it will be the root of a new history that is
> not connected to any the other branches or commits).
> +
> An orphan branch allows you to start a new history that records a set of
> paths similar to <start_point>.
Strictly speaking, an orphan branch allows you to start a new history that
does not have any existing commit as its ancestry, and that is all there
to it. While the "mostly common paths" aspect is worth mentioning, as it
is the use case it primarily targets, it is still secondary to the
description of "what it does." "What it is used for" should come after
the reader is told "what it does."
It would probably be better to say that the index and the working tree is
kept intact during --orphan process as part of "what it does", before
talking about "mostly common paths":
Create a new branch <new_branch> and switch to it. The first
commit you will make on this branch will become the root of a new
history, disconnected from any of existing commits.
The index and the working tree is adjusted as if you ran "git
checkout <start_point>" (without -b nor paths), to allow you to
easily record the root commit of the new history that records a
set of paths similar to <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 an open source branch of a project
> whose current tree is "clean", but whose full history contains
> proprietary
> or otherwise encumbered bits of code.
Good.
> +
> If you want to start a disconnected history that records a set of paths
> that is totally different from <start_point>, you may want to clear the
> index and the working tree after creating the orphan branch.
> Run `git rm -rf .` from the top level of the working tree, then prepare
> your new files by copying them from elsewhere, extracting a tarball, or
> otherwise populating the working tree.
Good, even though I am tempted to suggest rephrasing it further:
If you want to start a disconnected history that records a set of
paths that is totally different from <start_point>, you could
clear the index and the working tree after creating the orphan
branch by running `git rm -rf .` from the top level of the working
tree. Then prepare your new files by copying them from elsewhere,
extracting a tarball, or otherwise populating the working tree.
In general, however, it is cleaner and easier to create such an
unrelated history in a separate repository than creating in the
same repository.
prev parent reply other threads:[~2010-03-22 20:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-21 15:34 [PATCH v3] git checkout: create unparented branch by --orphan Erick Mattos
2010-03-21 17:14 ` Peter Baumann
2010-03-21 17:55 ` Erick Mattos
2010-03-21 19:37 ` Junio C Hamano
2010-03-21 21:15 ` Erick Mattos
2010-03-22 8:54 ` Michael J Gruber
2010-03-22 12:46 ` Chris Johnsen
2010-03-22 14:36 ` Erick Mattos
2010-03-21 21:38 ` Junio C Hamano
2010-03-22 12:43 ` Chris Johnsen
2010-03-22 14:14 ` Erick Mattos
2010-03-22 16:06 ` Translating error messages in Git (was: Re: [PATCH v3] git checkout: create unparented branch by --orphan) Jakub Narebski
2010-03-22 20:19 ` Junio C Hamano [this message]
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=7vljdk85z4.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=chris_johnsen@pobox.com \
--cc=erick.mattos@gmail.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).