I am trying to checkout a branch that I was checking out with success in the past, and I can't check it out anymore. Here are the different messages I am getting. The easy solution would be to reset my folder, do a
git init and
git clone, but I do not want to reset my git folder as I set up things like git hooks (
post-merge, etc). How could I get this to work again without resetting everything?
fatal: A branch named 'stage' already exists.
git fatal: reference is not a tree
error: refs/heads/stage does not point to a valid object!
fatal: bad object stage
In Git branch is simply a pointer. The pointer is to the
SHA-1 of the current commit in the branch and this information is stored in the file you just deleted:
If you wish to verify that your repository does not contains any more loose objects (dangaling) or un-reached branches check it with this:
git fsck --full
The way to solve this in a clean way is to delete your corrupted branch in