Delete the Previous Commit in Git
This page answers questions like these:
- How to remove the previous commit in Git?
- How to undo the previous commit in Git?
- How to reverse the previous commit in Git?
- How to rollback the previous commit in Git?
Related Links:
Revert Uncommitted Changes in Git
Change Git Commit Messages
Delete the Previous Commit in git
git reset --hard HEAD^
- Deletes the previous commit.
- Caveats: Dangerous operation which cannot be undone.
Delete the Previous 2 Commits in git
git reset --hard HEAD~2
- Deletes the last 2 commits.
- Caveats: Dangerous operation which cannot be undone.
Delete the Previous 3 Commits in git
git reset --hard HEAD~3
- Deletes the last 3 commits.
- Caveats: Dangerous operation which cannot be undone.
Related Links:
Revert Uncommitted Changes in Git
Change Git Commit Messages
Home > Git > Delete the Previous Commit in Git
Tags: git delete commit, git delete previous commit, git remove commit, git undo commit, git reverse commit, git rollback commit, git, linux, unix, solaris, bsd, aix
Copyright © HelpDoco.com
git-delete-previous-commit.txt
Git/git-delete-previous-commit.htm
3