All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Erick Mattos <erick.mattos@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] git checkout -b: unparent the new branch with -o
Date: Tue, 23 Feb 2010 15:26:01 -0800 (PST)	[thread overview]
Message-ID: <m3ocjfmt60.fsf@localhost.localdomain> (raw)
In-Reply-To: <1266960007-16127-1-git-send-email-erick.mattos@gmail.com>

Erick Mattos <erick.mattos@gmail.com> writes:

> Subject: [PATCH] git checkout -b: unparent the new branch with -o

I would say it is rather: "git checkout -b: allow creating unrelated branch",
or something like that.

By the way, for the solution to be complete it should work not only for 
"git checkout -b" shortcut, but also for "git branch".

>
> 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.

I'm not sure if 'unrelated but _intended to merge_' is most common
workflow utilizing unrelated branches... and whether git should
promote such workflow, even if only describing it in the commit
message.

> 
> The new -o/--orphan is intended to solve this situation allowing the
> creation of a new branch unparented to any other.

I think that for example '--root', or '--rootless', or '--unrelated'
would be a better name than '--orphan'.  Besides I don't think that
such rarely used option should squat on rare resource of single-letter
option.

> 
> 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.

Does it mean that the index is empty, but the working area is
unchanged?  It is not clear from the commit message.

> 
> Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
> ---
[...]

> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -9,7 +9,7 @@ SYNOPSIS
>  --------
>  [verse]
>  'git checkout' [-q] [-f] [-m] [<branch>]
> -'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<start_point>]
> +'git checkout' [-q] [-f] [-m] [-b <new_branch> [-o]] [<start_point>]

This is not stricly correct, as you can use either '-o' OR '<start_point>',
but not both (but you can use '-o' only together with '-b <new_branch>').



> +-o::
> +--orphan::
> +	When creating a new branch, set it up as unparented thus
> +	unrelated to the previous branch.
> +

Unparented?  Perhaps "set it up so first commit on this branch would
be root (parenless) commit".  Hmmm... it is not easy to describe it
well...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

  parent reply	other threads:[~2010-02-23 23:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 21:20 [PATCH] git checkout -b: unparent the new branch with -o Erick Mattos
2010-02-23 21:56 ` Junio C Hamano
2010-02-24 22:23   ` Erick Mattos
2010-02-24 22:40     ` Erick Mattos
2010-02-24 22:27   ` Erick Mattos
2010-02-23 23:26 ` Jakub Narebski [this message]
     [not found]   ` <55bacdd31002241410h747ae221xd72dfcf269bdb84e@mail.gmail.com>
2010-02-24 22:14     ` Erick Mattos

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=m3ocjfmt60.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=erick.mattos@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.