Uh oh... I mistakenly committed a pretty complex change (including subdirectory and files renames) without really knowing what I am doing (or what Git would be doing).
I now want to undo everything such that:
- commit is completely reversed (as if it has never been done, perhaps removing it from history as well)
- Restore current working directory
(where
.git
is) to a certain branch (last one will do for now).
I found references to git reset --soft and git reset --hard but I have already proven to myself that I can do real damage by prematurely using a command without fully understanding it. :)
I found the git reset man page but I am still confused as to:
- What is
HEAD
? - What is the difference between
HEAD
and* master
? - In my situation (see above) do I
need to use
--soft
,--hard
or other (3 more options)? - Do I need to run another command
(after doing
git reset
) to "finalize" the reversal?
UPDATE: After reading the answer below:
- Do I understand correctly that all I
need to do in my situation is issue
a single command
git reset --hard HEAD^
? - How do I verify that reversal was performed correctly?