标签云

微信群

扫码加入我们

WeChat QR Code

I have 4 branches like master -> origin/regacy, FeatureA -> origin/FeatureA.As you can see above, I typed the wrong name. So I want to rename a remote branch name ( origin/regacy => origin/legacy or origin/master)I try to command below:git remote rename regacy legacyBut git console returned error msg to me. error : Could not rename config section 'remote.regacy' to 'remote.legacy'How can i solve this problem?


See stackoverflow.com/questions/1526794/…

2019年03月26日15分38秒

Possible duplicate of How do I rename a local Git branch?

2019年03月27日15分38秒

You still need to do something, after the above and when I try to pull I get message: Your configuration specifies to merge with the ref ''refs/heads/old_name'

2019年03月26日15分38秒

Dont forget to unset the old upstream: git checkout <new_name> ; git branch --unset-upstream

2019年03月27日15分38秒

MiguelPing's comment is important. When trying to rename a branch I've already pushed to github, deleting, renaming local, it and re-pushing results in the old name being used again. If I --unset-upstream before re-pushing, it works as intended.

2019年03月27日15分38秒

After the first 2 steps, if you get an error message about the current branch points to a non-existence branch on the remote repo, the 3rd step fixes this

2019年03月26日15分38秒

Dr1Ku Need to know the difference between git push <remote> --delete old_name & git push origin :old-name new-name to delete a branch.

2019年03月26日15分38秒

Didn't work in git 2.20.1 Deleted the old branch but the new one was not created.

2019年03月26日15分38秒