The difference between git reset and git reset --hard

git reset  HEAD

Go back to the previous version, but the content modified on the basis of the previous version is still

git reset  --hard  HEAD

Back to the previous version, the modified content is gone.

Such as: modify the code, add "third submission"

 submit

Git reset HEAD~1

Reverted, but the "third submission" is still there

If you use: git reset HEAD~1

The "third submission" is gone

Guess you like

Origin blog.csdn.net/orangapple/article/details/109157385