Reverting a single file

Stefan Baumgartner

Written by @ddprrt

More on Git

You can do the following to revert a single filename to its previous status.

If the file isn’t commited: #

git checkout filename

If the file is already commited #

filename is the path to your file, abcde is the hash of the commit you want to switch to.

git checkout abcde filename


git reset abcde filename

More articles on Git

Change case to lowercase for committed files

Delete a commit on your remote

Stay up to date!

3-4 updates per month, spam-free, hand-crafted. Our newsletter gives you links, updates on fettblog.eu, conference talks, coding soundtracks, and much more.