git reset <commit>
更改HEAD指向的位置,但不会将文件还原为该提交时的状态。如果要将文件还原为提交时的外观,则需要git reset --hard <commit>
关于三种重置模式:
--soft
Does not touch the index file or the working tree at all (but
resets the head to <commit>, just like all modes do). This
leaves all your changed files "Changes to be committed", as git
status would put it.
--mixed
Resets the index but not the working tree (i.e., the changed
files are preserved but not marked for commit) and reports what
has not been updated. This is the default action.
If -N is specified, removed paths are marked as intent-to-add
(see git-add(1)).
--hard
Resets the index and working tree. Any changes to tracked files
in the working tree since <commit> are discarded.
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句