Revert changes to a file in a commit

Lakshman Prasad picture Lakshman Prasad · Apr 12, 2010 · Viewed 66.4k times · Source

I want to revert changes made by a particular commit to a given file only.

Can I use git revert command for that?

Any other simple way to do it?

Answer

mgalgs picture mgalgs · Aug 25, 2011

The cleanest way I've seen of doing this is described here

git show some_commit_sha1 -- some_file.c | git apply -R

Similar to VonC's response but using git show and git apply.