📌  相关文章
📜  git 返回到最后一次提交 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:30.731000             🧑  作者: Mango

代码示例5
git log
    commit 101: bad commit    # Latest commit. This would be called 'HEAD'.
    commit 100: good commit   # Second to last commit. This is the one we want.
To restore everything back to the way it was prior to the last commit, we need to reset to the commit before HEAD:

git reset --soft HEAD^     # Use --soft if you want to keep your changes
git reset --hard HEAD^     # Use --hard if you don't care about keeping the changes you made