- Undo it but keep the changes
git reset --soft HEAD~1Your changes stay staged, ready to commit again.
- Or undo it and throw the changes away
git reset --hard HEAD~1This deletes the changes for good. Already pushed? Use Undo a commit you already pushed instead.
Check it worked
- See your latest commits
git log --oneline -5
- Undo it but keep the changes
git reset --soft HEAD~1Your changes stay staged, ready to commit again.
- Or undo it and throw the changes away
git reset --hard HEAD~1This deletes the changes for good. Already pushed? Use Undo a commit you already pushed instead.
Check it worked
- See your latest commits
git log --oneline -5
- Undo it but keep the changes
git reset --soft HEAD~1Your changes stay staged, ready to commit again.
- Or undo it and throw the changes away
git reset --hard HEAD~1This deletes the changes for good. Already pushed? Use Undo a commit you already pushed instead.
Check it worked
- See your latest commits
git log --oneline -5