Reputation: 805
So, I have read that the git reset --keep
works like --hard
but remains unstaged changes.
So, if I just git reset --hard
, I will get into the original HEAD
state with clear index.
So, there is a question: Does the git reset --keep HEAD
do nothing? Or what is the difference?
If I do the git reset --keep HEAD~1
, will it work like there is no HEAD~1
commit but I have made the changes on files?
Upvotes: 0
Views: 448
Reputation: 67842
Does this answer your question?
--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.
The --hard
option forcibly overwrites local changes, and --keep
... keeps them ... by refusing to do anything that would overwrite a local change.
Upvotes: 2