git-branch -m cannot rename remote branches
I cannot rename remote branch (possibly packed, and possibly with reflog) using "git branch"
[gitweb/web@git]$ git branch -m refs/remotes/gitweb-caching/master \
refs/remotes/gitweb-kernel.org/master
error: refname refs/heads/refs/remotes/gitweb-caching/master not found
fatal: Branch rename failed
[gitweb/web@git]$ git branch -m gitweb-caching/master \
gitweb-kernel.org/master
error: refname refs/heads/gitweb-caching/master not found
fatal: Branch rename failed
[gitweb/web@git]$ git branch -m remotes/gitweb-caching/master \
remotes/gitweb-kernel.org/master
error: refname refs/heads/remotes/gitweb-caching/master not found
fatal: Branch rename failedSignature · 2 lines
Jakub Narebski Poland
Hi,
Quoted 2 lines · Jakub Narebski
I cannot rename remote branch (possibly packed, and possibly with reflog) using "git branch"
That is very much by design; a next fetch would get them with their current name anyway. A "remote prune" should get rid of any stale branches.
So yes, "branch -m" with remote branches does not make sense.
Ciao,
Dscho
Quoted 10 lines · Johannes Schindelin
Quoted 2 lines · Jakub Narebski
I cannot rename remote branch (possibly packed, and possibly with reflog) using "git branch"
That is very much by design; a next fetch would get them with their current name anyway. A "remote prune" should get rid of any stale branches.
So yes, "branch -m" with remote branches does not make sense.
What I really wanted was "git remote rename <old-name> <new-name>", together with renaming branches and moving reflogs. I can do first part by editing config file ("git remote rename"/"git remote mv" probably would want to assume that user wants to move branches if they follow remotes/<old-name>/* calling convention; ask user if it is not the case?). I thought that I could use "git branch -m" for the other... I was left with editing packed-refs file (BTW. is leaving empty directory 'xx' when packing 'xx/name' branch by design?) and moving reflog by hand.
Signature · 2 lines
Jakub Narebski Poland
Quoted 11 lines · Jakub Narebski
What I really wanted was "git remote rename <old-name> <new-name>", together with renaming branches and moving reflogs. I can do first part by editing config file ("git remote rename"/"git remote mv" probably would want to assume that user wants to move branches if they follow remotes/<old-name>/* calling convention; ask user if it is not the case?). I thought that I could use "git branch -m" for the other... I was left with editing packed-refs file (BTW. is leaving empty directory 'xx' when packing 'xx/name' branch by design?) and moving reflog by hand.
You can use "git update-ref" for that. Maybe something like that:
$ git update-ref <newref> <oldref> $ git update-ref -d <oldref> <newref>
Olivier.