How to undo the last git commit in local repository?
Undo last local commit but keep files changes.
- All the changes committed in the last commit is present in the local repo.
- Changes are not present in stage.
Undo last local commit and keep files changes in stage.
- No need to do
git add
again to add the changes to stage.
Undo last local commit and remove the changes from the repository.
- Git commit has been reversed.
- The changes also removed from the local repository.
- This option can be used before start using the branch. Just to make sure the branch is clean before making changes.