Revert Latest Commit on a git repo

February 19, 2019

I have changes committed to my branch that I want to revert.

$ git checkout HEAD~1 -- filename.txt

This will look at the file filename.txt, look back one commit from HEAD, and then replace the contents of filename.txt with that version one commit back.

Tags: git checkout reset head