Nacha
Nacha

Reputation: 107

can git checkout be undone?

I had committed my changes on the local and then did accidentally did a checkout from remote branch and have lost all my changes! Help - is there anyway I can get back to my committed changes?

Upvotes: 0

Views: 177

Answers (3)

Sailesh
Sailesh

Reputation: 26197

git reflog

Look for your commit and do a checkout.

Upvotes: 3

manojlds
manojlds

Reputation: 301037

Since you have committed your changes, you need not worry. Just do this:

git checkout -

it will take you back to the branch you were in.

Upvotes: 1

user849425
user849425

Reputation:

Fixing un-committed mistakes

If you've messed up the working tree, but haven't yet committed your mistake, you can return the entire working tree to the last committed state with

$ git reset --hard HEAD

Git Book

Upvotes: 0

Related Questions