# Reverting a subdirectory of a repo

1 messages from 2011-05-15 to 2011-05-15. Participants: Jay Soffian.
Thread: https://gitlist.dev/t/27359

## Jay Soffian, 2011-05-15 13:10

Subject: Reverting a subdirectory of a repo
Message-ID: <BANLkTikzV7EHyZUqUXqORebjWAkb_PAX6w@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTikzV7EHyZUqUXqORebjWAkb_PAX6w%40mail.gmail.com

```
Recently I wanted to revert a subdirectory of a repo to an earlier
state, so I did this:

$ git checkout <revision> -- /path/to/subdir
$ git commit

And I was surprised that the subdir retained files that had been added
since <revision>. To get a clean revert, I had to:

$ git rm -r /path/to/subdir
$ git checkout <revision> -- /path/to/subdir
$ git commmit

And I'm wondering if requiring the "rm" first is bug or a feature. On
the one hand, in retrospect I understand why it's needed, but otoh, it
did catch me off guard the first time.

j.

```
