The manpage of git reset
says:
--hard
Resets the index and working tree. Any changes to tracked files in the working tree since
<commit>
are discarded.--merge
Resets the index and updates the files in the working tree that are different between
<commit>
andHEAD
, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). If a file that is different between<commit>
and the index has unstaged changes, reset is aborted. In other words, --merge does something like agit read-tree -u -m <commit>
, but carries forward unmerged index entries.--keep
Resets index entries and updates files in the working tree that are different between
<commit>
andHEAD
. If a file that is different between<commit>
andHEAD
has local changes, reset is aborted.
I have trouble understanding the differences between the --hard, --merge, and --keep, possibly due to lack of understanding the different kinds of changes that are involved.
Could you rephrase and explain what they mean in more plain and explicit way?
Thanks.