How do I remove a file change from a commit that has not been pushed to origin in git?
I have a file that I accidentally added to my most recent commit. I want to remove the changes, but leave the file in the repository. That is because it is a generated sass stylesheet and I always have merge problems with it. Since the server will regenerate it anyway I would really like to just avoid committing it.
2 Solutions collect form web for “How do I remove a file change from a commit that has not been pushed to origin in git?”
Make a new commit that puts everything in the state you want it to be in, then squash it (via
git rebase -i) into your most recent commit.
The answers in this question will likely contain what you need and more for undoing a local commit.