When I try any of these commands:
git branch
git branch -a
git pull
git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Cblue[%cn]\\%Creset %s" --decorate --graph
git log --online --decorate --graph
I get the error
fatal: Reference has invalid format: 'refs/heads/master~'
But the following commands work:
git log --oneline --graph # removed --decorate
git log
Running
find ./ -iname "*conflict*"
doesn't return any results.
The output of find ./ -name "*master*" | grep "\./\.git"
is
./.git/logs/refs/heads/master
./.git/logs/refs/heads/master~
./.git/logs/refs/remotes/origin/master
./.git/refs/heads/master
./.git/refs/heads/master~
./.git/refs/remotes/origin/master
Don't know if that helps, but I see master~
in there.
Any idea what might be wrong? What other info can I provide you with?
It looks like some utility has created "backups" of the normal branch files (.git/refs/heads/...
) with a trailing ~
character. This are not allowed branch names in Git as they would conflict with the suffix notation ...~N
for obtaining ancestors.
Commands that don't need to query all refs (such as git log master
without --decorate
) are working but anything that tries to list all branches is choking on the invalid branch name.
Simply delete the file ./.git/refs/heads/master~
(after backing it up) and you should be good to go.
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