How to remove a file from pushed commit but keep the changes locally? July 26, 2021 Run the following commands: git reset --soft <SHA of previous commit> git restore --staged <File path> git commit -m <Commit message> git push -f CAUTION: This will squash all the commits after the previous commit Read more