Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git branch continually getting recreated on pull

Tags:

git

branch

pull

I have a git branch that continually gets 'recreated' with an alternating letter case every time I perform a 'git pull'. Assuming the branch name is 'a' (or 'A' for all I know), one 'git pull' will produce the line:

* [new branch]      a       -> origin/a

And then the next 'git pull' will produce:

* [new branch]      A       -> origin/A

This never stops. I don't know how the branch got created (or what it is for) as someone else created it.

How do I tame this branch and make it stop doing this?

like image 209
acoward Avatar asked May 16 '11 03:05

acoward


2 Answers

As mentioned in the comments, both refs/heads/A and refs/heads/a exist on the remote. That does mean that two distinct branches exist there. (Git itself is case sensitive, as are most non-Windows filesystems.)

If, however, you're using Windows, that would probably explain this problem. Refs are created as individual files, one per ref. Git sees both on the remote, but then when it attempts to update them locally, only one exists, so the other is always created. The internal order of the two operations must then be such that the newly created one overwrites the other, leading to the alternation.

If the refs are pointing to the same commit, then the solution is to delete one of them on the remote:

git push origin :refs/heads/A
like image 52
Cascabel Avatar answered Sep 19 '22 06:09

Cascabel


It seems that origin/a and origin/A are deleted locally since you get [new branch] all the time. If someone or something is deleting these references, you will get these branches every time you fetch (or pull) from the remote. Have you tried to re clone the repository? Are you the only one having this problem?

like image 33
ralphtheninja Avatar answered Sep 21 '22 06:09

ralphtheninja