So I have a kind of worst case scenario, I think.
I was about to push a branch to our local repo and due to some changes I had to make, pushed a branch delete of the branch in anticipation of re-pushing the branch that I was in the middle of meddling with.
In the middle of this, the power went out.
My local repo is no longer recognized as a git repo, and git fsck does nothing. The branch is not visible on origin.
Is there a way to recover from this? I see my branches in my local repo, but without being able to get it recognized as such, I cannot do anything about it.
Some options I have thought of but don't know how to implement:
Creating a new repo and somehow pulling the full repo with garbage to local and using functionality to restore my branch from garbage
Creating a new repo and somehow pulling my old branch data in manually
Assistance greatly appreciated.
My local repo is no longer recognized as a git repo ...
First, make backup copies of whatever you have now. Then try re-creating the HEAD
file:
echo ref: refs/heads/master > .git/HEAD
for instance. Then see if Git at least recognizes it. If so, git fsck
may be helpful, and/or there may be useful data in reflogs (for HEAD
and/or for your branches).