Question:
I did a commit and immediately after I noticed that I commit changes that I don't want to push to the remote .
Is there a way to undo the same by keeping those changes in my local copy to commit them properly again?
Answer:
If you want to keep the changes:
git reset [--mixed] HEAD~1
If you also don't want to load the commit (just move the head to the previous one):
git reset --soft HEAD~1
And if you don't want to keep them (and go back to the state of the previous commit, in practice destroy the last commit completely as if it never existed):
git reset --hard HEAD~1