Imagine you have just committed your changes and are ready to push them, as you noticed that you forgot to omit some confidential data. Fortunately, there is a way to undo this with the following command:
git reset HEAD~
Now, you have a "dirty" work directory again. From there, you can perform your changes.