zl程序教程

您现在的位置是:首页 >  工具

当前栏目

[Git] Use and Compare the Different git Reset Options: --hard, --soft, and --mixed

Git -- The and use reset Options different
2023-09-14 08:59:14 时间

git reset has three primary options that we might use: --soft--hard and --mixed (the default).

We'll use git reset to undo the latest commit in all three ways, and compare the result of reseting with each flag.

 

git reset --soft HEAD~1 // keep staging but remove commit

git reset --mixed HEAD~1 // remove staging and commit, but keep the changes

git reset --hard HEAD~1  // remove the changes, commit, and staging