Re: Plumbing to rename a ref?
- From
John Keeping <john@keeping.me.uk>
- Date
- May 23, 2014, 10:50 UTC
- Message-ID
- <20140523105047.GA2249@serenity.lan>
- In-Reply-To
- <87ha4golck.fsf@osv.gnss.ru>
On Fri, May 23, 2014 at 02:11:55PM +0400, Sergei Organov wrote:
Show 9 quoted lines
> 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).