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

Re: Plumbing to rename a ref?

From
John Keeping <john@keeping.me.uk>
Date
May 23, 2014, 17:14 UTC
Message-ID
<20140523171407.GB2249@serenity.lan>
In-Reply-To
<xmqqvbswjuaa.fsf@gitster.dls.corp.google.com>
On Fri, May 23, 2014 at 10:10:05AM -0700, Junio C Hamano wrote:
Show 30 quoted lines
> John Keeping <john@keeping.me.uk> writes:
> 
> > On Fri, May 23, 2014 at 02:11:55PM +0400, Sergei Organov wrote:
> >> Hello,
> >> 
> >> After convertion of a project from CVS to git, I'd like to rename some
> >> references in the created git repository (before it's published, so no
> >> problems here). Is there a plumbing that would do:
> >> 
> >> git rename-ref <old_name> <new_name>
> >> 
> >> for me?
> >
> > I think the best you can get is two invocations of `git update-ref`:
> >
> > 	git update-ref <new_name> <old_name> &&
> > 	git update-ref -d <old_name>
> >
> > Although if you're scripting it the `--stdin` mode may be easier:
> >
> > 	git update-ref --stdin <<-\EOF
> > 	create <new_name> <old_name>
> > 	delete <old_name>
> > 	EOF
> >
> > Note that "<new_name>" must be a fully-qualified ref (that is, it must
> > start with "refs/", so "refs/heads/new_name" for a branch or
> > "refs/tags/new_name" for a tag).
> 
> Shouldn't <old_name> also be a full ref?

I tested this before sending the email, and it seemed to do the right thing specifying only the branch name; so it probably /should/ be a full ref, but it seems like it doesn't /need/ to be.

Previous: Junio C Hamano
Message 8 of 8 in “Plumbing to rename a ref?”
  1. Sergei OrganovMay 23, 2014
  2. John KeepingMay 23, 2014
  3. Sergei OrganovMay 23, 2014
  4. Jeff KingMay 23, 2014
  5. Junio C HamanoMay 23, 2014
  6. Jeff KingMay 23, 2014
  7. Junio C HamanoMay 23, 2014
  8. John KeepingMay 23, 2014

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.