Update the remote of a git branch after name changing
Posted
by
Dror
on Super User
See other posts from Super User
or by Dror
Published on 2013-10-29T21:33:52Z
Indexed on
2013/10/29
22:00 UTC
Read the original article
Hit count: 257
git
Consider the following situation. A remote repository has two branches master
and b1
. In addition it has two clones repo1
and repo2
and both have b1
checked out. At some point, in repo1
the name of b1
was changed. As far as I can tell, the following is the right procedure to change the name of b1
:
$ git branch b1 b2 # changes the name of b1 to b2
$ git push remote :b1 # delete b1 remotely
$ git push --set-upstream origin b2 # create b2 remotely and direct the local branch to track the remote 1
Now, afterwards, in repo2
I face a problem. git pull
doesn't pull the changes from the branch (which is now called remotely b2
). The error returned is:
Your configuration specifies to merge with the ref 'b1'
from the remote, but no such ref was fetched.
What is the right way to do this? Both the renaming part and the updating in other clones?
© Super User or respective owner