I have 2 branches in my repository. There were no uncommitted changes in any of them.
I pulled the branch1, checked out branch2, and started a branch2 rebase on branch1.
In the middle of the work my PC crashed.
After it finally booted up, i open GitExtensions to find that my repository is totally empty, i see the flashing 'rebase under way'
or something like that, i click it and it pops me the window where i have to chose to fix conflicts, which did not supposed to happen. If i click 'solve' it opens the window where conflicting files should be shown and of course there is none.
I tried to click abort rebase
but it said that folder is not a git repository or any of the parents
.
Since then i can do NOTHING. I can't abort, can't see commits. Opening git bash just tells me /some/path/to repo/repo name ((...) | REBASE )
when i write git status
it says its not a repository.
Well i wouldn't care that much about failed rebase BUT, i noticed that all of my source files turned to binary files and that means, my unpushed commits are LOST, unless you guys can help me recover it.
I wanted to rebase the branch and push it.... this is frustrating.
EDIT 1:
.git
directory is in the repository directory (/some/path/to_repo/repo_name/.git
) as it should be.
The PC crashed at the point when branch2 commits were being reapplied. It means that branch1 commits were already applied to the branch2, the only thing left, was to finish applying branch2 commits. And it crashed after like 10 or 20 commits were applied.
I have now compared the .git direcotries of a cloned repo and the one which crashed.
Cloned repo had these folders:
hooks
info
logs
objects
refs
And these files:
config
description
HEAD
index
packed-refs
The crashed one has an extra folder named rebase-apply
, also extra files:
COMMIT_EDITMSG
FETCH_HEAD
ORIG_HEAD
Everything else seems to match. I didnt go into folders deeper. And didn't try to compare file contents.
After checking .git
directory files, i have noticed that ORIG_HEAD and HEAD files contained only NULLS. It seems i have finally figured out how to fix this.
index
file. ORIG_HEAD
file. HEAD
file.FETCH_HEAD
(it was pointing to a Branch1) HEAD
GIT Bash
git status
to check if it sees that the directory is a repository. (It did) git reset
command. git rebase --abort
command. At this point, all the binary source files were text files. Also index
file got recreated.
When i opened repository through GitExtensions, everything seemed to be back to normal, before the rebase. I tried the rebase once more, but it stopped at one of the commits with an error oferror: unable to unpack d447b241eba771f175cb2150eec77ec605a86486 header
error: inflateEnd: stream consistency error (no message)
fatal: d447b241eba771f175cb2150eec77ec605a86486 is not a valid object
Thats it. Now it is working once again. Seems that i have not done any damage to 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