// Richard Hart / Hates_

It took me longer then I expected it to, to find out how to revert a single file using git. Git revert is not it, that’s for creating a commit to undo the changes of another commit. Maybe git reset? No, that resets the current HEAD, not a specific file, it would seem. Turns out it’s just a simple re-checkout of the offending file. D’oh.

git checkout ${offending_file}
3 comments
  1. Emma Gahan says: October 10, 20088:35 am

    Geeze Richard i could have told you that!

  2. Tilo says: February 20, 200910:57 pm

    thanks for the tip! :) indeed not obvious, when coming from SVN or other VC-tools..

  3. Marina says: March 16, 20097:35 pm

    This tip came in useful! Thanks!

Submit comment