Actually, when you use git reset
, you should refer to the commit that you are resetting to; so you would want the db0c078
commit, probably.
An easier version would be git reset --hard HEAD^
, to reset to the previous commit before the current head; that way you don't have to be copying around commit IDs.
Beware when you do any git reset --hard
, as you can lose any uncommitted changes you have. You might want to check git status
to make sure your working copy is clean, or that you do want to blow away any changes that are there.
In addition, instead of HEAD you can use origin/master
as reference, as suggested by @bdonlan in the comments: git reset --hard origin/master
git reset --hard origin/master
, to reset it to whatever the origin was at. – bdonlan Oct 23 '09 at 3:25git reset
your code. Do your future self a favor: The difference betweenreset
,reset --soft
, andreset --hard
(What happens to your earliergit add
aka "your work" :) Picture: link – user18099 Jun 9 '17 at 10:00