Skip to contentSkip to conversation

reverting a file or files back to repository copy

DISCUSSION Aaron Gray 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Aaron Gray

author
#0 lore raw

How do I do the eqivalent of an 'svn revert' on a single file, on a directory of files, or on all files ?

I found 'git reset --hard HEAD' but it seems like a hammer to crack open a nut.

Many thanks in advance,

Aaron

#1 lore raw
Quoted 2 lines · Aaron Gray

How do I do the eqivalent of an 'svn revert' on a single file, on a directory of files, or on all files ?

git checkout <files>

Peter Harris

#2 lore raw

Peter Harris, 02.05.2009:

Quoted 5 lines · Aaron Gray
Quoted 2 lines

How do I do the eqivalent of an 'svn revert' on a single file, on a directory of files, or on all files ?

git checkout <files>

This will use the state of the files from the index.
To revert to the latest commit, i.e. discard all your local changes of particular files, use

git checkout HEAD -- <files>

Markus