git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: How do I copy a branch & its config to a new name?
Date: Fri, 24 Mar 2017 17:17:01 -0400	[thread overview]
Message-ID: <20170324211701.vvmp6n4c77o2dvbz@sigill.intra.peff.net> (raw)
In-Reply-To: <CACBZZX6U0PAAK8vJxBW2VSzbtfttFUNTZhDGk=BzLxkaTn64gw@mail.gmail.com>

On Fri, Mar 24, 2017 at 12:10:49PM +0100, Ævar Arnfjörð Bjarmason wrote:

> Actually this is a bit confusing, but I think reversing the arguments
> makes sense, i.e.:
> 
>     git branch -c dest [src]
> 
> And similarly:
> 
>     git checkout -c dest [<src>]
> 
> This is confusing in that it reverses the arguments, but more useful
> in that it allows you to omit src like the other invocations of these
> commands, and you can e.g. do:
> 
>     git branch -c avar/topic-2
> 
> While on avar/topic to start working on avar/topic-2, which would copy
> avar/topic's state & config.
> 
> I'll put this on my TODO list, but unless someone comes up with a
> compelling argument against the above I plan to make the interface
> look like that.

I think it probably should match "git branch -m", which uses:

  git branch -c [<oldbranch>] <newbranch>

That's the closest operation we currently have, and it still allows
omitting the src. It _is_ different than:

  git branch <branchname> [<start-point>]

I wondered if you could advertise "-c" not as a new "copy mode", but
rather as an option for normal branch creation. Sort of a "by the way,
copy the config". But I don't think that's a great mental model.
<start-point> doesn't have to be a branch at all.

-Peff

      reply	other threads:[~2017-03-24 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 22:46 How do I copy a branch & its config to a new name? Ævar Arnfjörð Bjarmason
2017-03-22 22:58 ` Jeff King
2017-03-22 23:54   ` Ævar Arnfjörð Bjarmason
2017-03-22 23:57     ` Jeff King
2017-03-24  0:52 ` Jonathan Nieder
2017-03-24 11:10   ` Ævar Arnfjörð Bjarmason
2017-03-24 21:17     ` Jeff King [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=20170324211701.vvmp6n4c77o2dvbz@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@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 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).