Git undo last local commit

From snippet wiki
Jump to navigation Jump to search

If you added the local changes and already did a commit in to your local repo, but it is still not pushed to the server. You can still undo that last step for adding some more changes:

git reset --soft HEAD~1

Now your local changes are in the modified state again, and are either to be committed or yet not staged for commit.