0

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> and HEAD, 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 a git 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> and HEAD. If a file that is different between <commit> and HEAD 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.

torek
  • 448,244
  • 59
  • 642
  • 775

1 Answers1

1

--hard: This basically takes you to the commit that you have mentioned and any changes since that commit made in your local is deleted.

For difference between --keep and --merge see: git reset --merge vs git reset --keep