Setting a broken git branch to a detached head -
after power loss during commit, 1 of branches in git repository got corrupted. did git fsck --full , deleted empty object files until fsck gave me:
checking object directories: 100% (256/256), done. checking objects: 100% (894584/894584), done. error: refs/heads/git-annex not point valid object! checking connectivity: 862549, done. i used git fsck --lost-found find last dangling commit on git-annex branch. checked out.
i want replacement git-annex head. tried git checkout -b git-annex got branch exists. tried git branch -d git-annex got error: couldn't commit object 'refs/heads/git-annex'.
how can rid of broken git-annex branch in order set commit want? have tried removing .git/refs/heads/git-annex doesn't work. thanks.
this works me (after "cheating" insert broken branch, , seeing same error when trying delete it):
git branch -f broked head # or other valid point git branch -d broked the second command gripes deletes broken ref .git/packed-refs (which assume must if removing .git/refs/heads/git-annex unhelpful). (but branch name "git-annex" makes me wonder if you're using git-annex, in, thing stores large files outside repo. have not used myself , not sure if changes anything.)
Comments
Post a Comment