To undo the last commit but keep changes staged: `git reset –soft HEAD~1`
To undo the last commit and unstage changes: `git reset –mixed HEAD~1`
To undo the last commit and discard changes: `git reset –hard HEAD~1`
To uncommit a specific number of commits: `git reset –soft HEAD~N`
To uncommit and keep changes in the working directory: `git reset –mixed HEAD~N`
To uncommit and remove all changes permanently: `git reset –hard HEAD~N`
To undo a pushed commit safely: `git revert
To uncommit the most recent commit and create a new commit later: `git reset –soft HEAD~1`
