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.

  • GitHub for Mac - Staging is not working correctly (Changes not staged for commit)
  • How to find the last few commits to a git repository
  • GIT: efficient way to prevent commiting non-functional changes?
  • Recover from Messed up commit to wrong origin
  • Amend past commit message in Git-Tower
  • Move tag one commit ahead
  • Git aliases with long options not working
  • Git + Smart HTTP problems (cannot push/pull)
  • capistrano ssh agent forwarding - Permission denied (publickey)
  • How do you revert a faulty git merge commit
  • Saving space for multiple copies of same git repository with different configs
  • commits in PR are not seen in git log
  • 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.

    Git Baby is a git and github fan, let's start git clone.