git revert
Create new commits which reverse the effect of earlier ones. More information: https://git-scm.com/docs/git-revert.
- Revert the most recent commit:
git revert HEAD
- Revert the 5th last commit:
git revert HEAD~4
- Revert a specific commit:
git revert
- Revert multiple commits:
git revert ..
- Don't create new commits, just change the working tree:
git revert ..
- Cancel a Git revert after a merge conflict:
git revert --abort
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
