Sorry for the ambiguous title. If anyone can come up with something better, please edit this to let me know.
Recently, I removed a git repository and checked out a fresh copy from the server. Unfortunately, when doing this, I had forgotten that I was using git-new-workdir
(I thought that I had cloned my repo checked twice). Now I can't do anything in my "workdir":
$ git log
fatal: bad default revision 'HEAD'
and a git status
gives way more changes than it should. Does anyone have any thoughts on how I can fix this?
More info:
Running git fsck
gives me the following:
$ git fsck
notice: HEAD points to an unborn branch (dipole_fix)
missing blob d92f4a4f53c95c375146d9623910d8ec214aa02f
missing blob 7d81095605082af3252a47b47d81e48d4a78a668
missing blob f5d21b7785c4bca4efaa91ce5ef5a8bd82d98792
missing blob 79d3ad61db697ca7e89dbfd089a472dab0a7851b
missing blob 2cf0e64cbc0a816d7dc1b26fef43c2eb7c4fb6ac
For what it's worth, I do have a remote branch with the dipole_fix
branch on it. It should be (relatively) up to date.
Update 1 -- Looking at the contents of .git
in the workdir, it appears that I have a few dangling symbolic links.
lrwxrwxrwx 1 mgilson mgilson 39 2012-04-26 10:43 remotes -> /orig_repo/.git/remotes
lrwxrwxrwx 1 mgilson mgilson 40 2012-04-26 10:43 rr-cache -> /orig_repo/.git/rr-cache
lrwxrwxrwx 1 mgilson mgilson 35 2012-04-26 10:43 svn -> /orig_repo/.git/svn
Update 2 -- Naievly linking remotes
to /orig_repo/refs/remotes
seems to get rid of the "bad head" problem, but now a git status
gives me:
error: unable to find d92f4a4f53c95c375146d9623910d8ec214aa02f
error: unable to find d92f4a4f53c95c375146d9623910d8ec214aa02f
error: unable to find f5d21b7785c4bca4efaa91ce5ef5a8bd82d98792
error: unable to find f5d21b7785c4bca4efaa91ce5ef5a8bd82d98792
error: unable to find 79d3ad61db697ca7e89dbfd089a472dab0a7851b
error: unable to find 79d3ad61db697ca7e89dbfd089a472dab0a7851b
HEAD is easy to fix, just git checkout
something. (or you can even edit .git/HEAD using an editor, placing a ref: or a hit hash). Or create that missing dipole_fix local branch. (you can view the just mentioned file to see where it points...)
The dangling links: fix them or delete them.
Check your current branch by:
git branch
If it doesn't show you any branch as the current branch then try:
git reset --hard <some branch>
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