# You made changes to a file, you haven't staged or committed
git co file_changed # revert that file
git co . # revert all changed filesgit add dir/a.txt # to stage
git reset HEAD dir/a.txt # to unstagegit ca "Commit some files" # to commit
git reset HEAD~1 # On windows use tilda, un-commit the last number of commits# You committed and pushed a "Regrettable commit"
git reset --hard HEAD~1
git push origin master --force
# Now by looking at the commit page on origin, the regretable commit is gone from the list
git reflog
# git does not really delete anything, you can still see your regretable commit with reflog https://stackoverflow.com/a/8730046/32240
If you haven't pushed that change yet, git reset --hard HEAD^