Deleted branch in GitX, now can't leave branch in terminal

720 views Asked by At

I deleted my active branch in GitX, and now I can't seem to get out of it in the terminal.

When I try to check out any other branch, it tells me I have unstashed changes -- but I can't stash them (I get "fatal: bad revision 'HEAD'").

I've tried to re-create the branch, but then I get "fatal: You are on a branch yet to be born"

And I've tried to merely check out the branch, but of course, since it's deleted, I can't.

How can I get un-stuck?

2

There are 2 answers

0
jawns317 On

git reset --hard [SHA of previous master commit]

0
Shrikant Shete On

I faced the same issue. When I was trying to checkout to other branch I got Please commit your changes or stash them before you switch branches. message. I did a sample commit on a local branch (which is already deleted) but did not push the changes. And then I was able to checkout to some other branch. Now you can delete the local branch.