By mistake I have reset hard by using following command :
git reset --hard HEAD~
Now I want to undo all commits and the affect which git reset have made,and want to goto where I started today, Can I do that?
By mistake I have reset hard by using following command :
git reset --hard HEAD~
Now I want to undo all commits and the affect which git reset have made,and want to goto where I started today, Can I do that?
git reset
does not create commits.
The best bet for undoing a git reset
is to do another git reset
, using the reflog.
git reflog
should show a list of where HEAD
has recently been (in the local repository). Hopefully one of those entries will be "where you started today". In the case where the reset is all you did, this will be identified as HEAD@{1}
, so you would then do
git reset --hard HEAD@{1}