# reverting a file or files back to repository copy

3 messages from 2009-05-02 to 2009-05-02. Participants: Aaron Gray, Peter Harris, Markus Heidelberg.
Thread: https://gitlist.dev/t/19159

## Aaron Gray, 2009-05-02 14:54

Subject: reverting a file or files back to repository copy
Message-ID: <137A749092D040488A7F25B4CA5ED1DC@HPLAPTOP>
URL: https://gitlist.dev/e/137A749092D040488A7F25B4CA5ED1DC%40HPLAPTOP

```
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

```

## Peter Harris, 2009-05-02 15:25

Subject: Re: reverting a file or files back to repository copy
Message-ID: <eaa105840905020825v561f610dj99b1b00581bf1b3d@mail.gmail.com>
URL: https://gitlist.dev/e/eaa105840905020825v561f610dj99b1b00581bf1b3d%40mail.gmail.com
In-Reply-To: <137A749092D040488A7F25B4CA5ED1DC@HPLAPTOP>

```
On Sat, May 2, 2009 at 10:54 AM, Aaron Gray wrote:
> 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

```

## Markus Heidelberg, 2009-05-02 15:33

Subject: Re: reverting a file or files back to repository copy
Message-ID: <200905021733.08557.markus.heidelberg@web.de>
URL: https://gitlist.dev/e/200905021733.08557.markus.heidelberg%40web.de
In-Reply-To: <eaa105840905020825v561f610dj99b1b00581bf1b3d@mail.gmail.com>

```
Peter Harris, 02.05.2009:
> On Sat, May 2, 2009 at 10:54 AM, Aaron Gray wrote:
> > 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

```
