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?
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
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With