开发者

Git double entry for refs/head in git ls-remote

When I run

$ git
ls-remote
git@foo:bar.git 

I get

6826f9697d4b887a0eaa1aaf9338dee23569970a    HEAD
90ff949b16803724913bb85a72e57c4e5d4c4625    refs/head/master
6826f9697d4b887a0eaa1aaf9338dee23569970a    refs/heads/master

it looks like that refs/head/master shouldn't be there and it is messing up my deployment with capistrano b开发者_运维技巧ecause it is checking out the first master it finds. How can I check what it contains and delete it?


Yeah, refs/head/master shouldn't be there. It looks like someone accidentally pushed to refs/head/master, when they meant to push to refs/heads/master.

You can pull the content of your screwed up master with something like:

git fetch git@foo:bar.git refs/head/master:broken-master

This will give you a local branch, broken-master, which contains what the incorrect ref on the server contains. Once you've satisfactorily merged anything that might have gotten stuck in there, and are ready to delete it on the server, you can do the following to delete the broken branch on the server.

git push git@foo:bar.git :refs/head/master

Depending on the server settings, you may need to use a -f flag to force the server to delete the branch.

You will probably also want to use git branch -d broken-master to clean up your temporary local branch that you used for inspecting the contents of the screwed up ref, as long as you've merged everything up or decided it's OK to discard.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜