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

Re: [RFC] Teach git-branch howto rename a branch

From
LHLars Hjemli <hjemli@gmail.com>
Date
Nov 25, 2006, 11:00 UTC
Message-ID
<8c5c35580611250300q521c5723t2d356d73d4c4fdb6@mail.gmail.com>
In-Reply-To
<4c8ef70611250239h4e03b9c7k971b60187aa0f56d@mail.gmail.com>
On 11/25/06, Fredrik Kuivinen <frekui@gmail.com> wrote:
Show 16 quoted lines
> On 11/25/06, Lars Hjemli <hjemli@gmail.com> wrote:
> > This adds a '--rename' option to git branch. If specified, branch
> > creation becomes branch renaming.
> >
> > With a single branchname, the current branch is renamed and .git/HEAD is
> > updated.
> >
> > With two branchnames, the second name is renamed to the first.
>
> Nice idea. But wouldn't it be more sensible to rename the first branch to the
> second instead of the other way around? That is, the syntax would be
>
>     git branch --rename FROM TO
>
> which is more similar to how "mv" works.
>
Possibly, but then we would have
  git branch newbranch [oldbranch]
when creating a new branch, and
  git branch --rename [oldbranch] newbranch
for rename/move.

I'd prefer to be "internally consistent", but it does look and feel a little strange...

Another option would be:
  git branch [--rename] [--from <branch>] newbranch
and deprecate the usage of two unnamed argumens for create/rename
Previous: Fredrik KuivinenNext: Josef Weidendorfer
Message 12 of 13 in “[RFC] Teach git-branch howto rename a branch”
  1. Lars HjemliNov 24, 2006
  2. Junio C HamanoNov 25, 2006
  3. Shawn PearceNov 25, 2006
  4. Jakub NarebskiNov 25, 2006
  5. Shawn PearceNov 25, 2006
  6. Lars HjemliNov 25, 2006
  7. Junio C HamanoNov 25, 2006
  8. Lars HjemliNov 25, 2006
  9. git-branch -D: make it work even when on a yet-to-be-born branchJunio C Hamano, Nov 25, 2006
  10. Lars HjemliNov 25, 2006
  11. Fredrik KuivinenNov 25, 2006
  12. Lars HjemliNov 25, 2006
  13. Josef WeidendorferNov 26, 2006

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.