美文网首页
git reset 了解

git reset 了解

作者: Zulu_c02a | 来源:发表于2018-08-18 18:14 被阅读0次

git reset 表示重置,hard 和soft 表示重置的范围不一样,hard的范围比较大一点,git reset --hard表示同时重置暂存区和工作区,而soft的范围较小。

git reset --hard
Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded.
重置整个工作树和目录,即使这个文件已经被提交到本地仓库了,也要将这个文件的改变取消掉,变回改变前的状态。我的理解是重置的范围较大,包括了目录和工作树。
git reset --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.
并不重置工作树和目录文件,仅仅撤销提交。
git-revert - Revert some existing commits

具体看网址

相关文章

网友评论

      本文标题:git reset 了解

      本文链接:https://www.haomeiwen.com/subject/qvwfiftx.html