gitversion-controlrevert

Revert changes to a file in a commit


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?


Solution

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

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

    Show the change and reverse it. Similar to VonC's response but using git show and git apply.