git restore filename --staged
git checkout filename
git clean -f filename or leave empty to delete all untracked files
-
git reset sha1 or label
(choose before our latest commit). This command doesn't remove any local changes you had done before pushing to remote. -
Do your changes (probably using steps above)
-
git commit -m "Your comment"
-
git push -f origin your branch