git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How do I copy a branch & its config to a new name?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 24, 2017, 11:10 UTC
Message-ID
<CACBZZX6U0PAAK8vJxBW2VSzbtfttFUNTZhDGk=BzLxkaTn64gw@mail.gmail.com>
In-Reply-To
<20170324005249.GF20794@aiede.mtv.corp.google.com>
On Fri, Mar 24, 2017 at 1:52 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
> Hi,
>
> Ęvar Arnfjörš Bjarmason wrote:
>
>> I couldn't find any previous list discussion about this, but if not I
>> think something like:
>>
>>     git [checkout|branch] --copy src dest
>>
>> Would make sense as an interface for this.
>
> Sounds good to me. :)

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.

Previous: Jonathan NiederNext: Jeff King
Message 6 of 7 in “How do I copy a branch & its config to a new name?”
  1. Ævar Arnfjörð BjarmasonMar 22, 2017
  2. Jeff KingMar 22, 2017
  3. Ævar Arnfjörð BjarmasonMar 22, 2017
  4. Jeff KingMar 22, 2017
  5. Jonathan NiederMar 24, 2017
  6. Ævar Arnfjörð BjarmasonMar 24, 2017
  7. Jeff KingMar 24, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.