I have a fork of a Git repo and my clone appears to have an issue with an old, no longer existant, branch. I keep seeing this message:
error: refs/heads/t_1140 does not point to a valid object!
I don't have any other messages and the repo works fine. There's no operation that stops me from working on other branches, pushing changes, pulling...etc.
I've looked around and there's less than clear instructions on how to get around this issue. I've tried to execute git fsck --full
but I see no errors. Just a load on dangling ...
messages.
I've also checked my .git/config
and there's no references to this branch and have also checked .git/refs/heads
and there's no reference to t_1140
Any idea how to get rid of this error?
p.s I've tried to clone my repo again and it seems like the error is my Github repo too. So, the only thing I can think of right now is to ditch my repo and fork again.
This will clean out any missing refs:
git for-each-ref --format="%(refname)" | while read ref; do
git show-ref --quiet --verify $ref 2>/dev/null || git update-ref -d $ref
done
Check .git/refs/remotes/origin
. They are there and the upstream no longer has them. To clean out the remotes that no longer exist run
git remote prune origin
You could also see what it would to by adding --dry-run
before actually doing it.
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