What is difference between 'git reset --hard HEAD~1' and 'git reset --soft HEAD~1'?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I tried to undo my commit in git. Is it dangerous to use git reset --hard HEAD~1 ? What is the difference between different options for git reset ? Is there also any other way to undo a commit by Sourcetree Gui? 回答1: git reset does know five "modes": soft, mixed, hard, merge and keep. I will discuss the first three, since those are the ones you usually use. soft When using git reset --soft HEAD~1 you will undo the last commit, but the file changes will stay in your working tree. Also the changes will stay on your index, so following with a