Reputation: 351
I did (on master)
git branch mybranch
and then (still on master)
git reset --hard "commitid"
Now it seems I lost the commits after "commitid". Really? I lost it?
Is there anyway to recover?
Upvotes: 1
Views: 62
Reputation: 43304
Simply checkout the new branch and the commits should be there
$ git checkout mybranch
This process is also useful when you want to move some recent commits to a new branch.
Upvotes: 1
Reputation: 20710
They are saved in the new branch you just created.
git reset --hard mybranch
Upvotes: 1
Reputation: 4061
Yes, use git reflog to find the point just before the git reset. Then you can use something like this
git reset --hard HEAD@{1}
Upvotes: 3