{"thread":{"id":"27359","subject":"Reverting a subdirectory of a repo","startedAt":"2011-05-15T13:10:29Z","lastAt":"2011-05-15T13:10:29Z","messageCount":1,"participants":["Jay Soffian"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"167893","messageId":"BANLkTikzV7EHyZUqUXqORebjWAkb_PAX6w@mail.gmail.com","threadId":"27359","inReplyTo":null,"subject":"Reverting a subdirectory of a repo","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-05-15T13:10:29Z","receivedAt":"2011-05-15T13:10:29Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Recently I wanted to revert a subdirectory of a repo to an earlier\nstate, so I did this:\n\n$ git checkout <revision> -- /path/to/subdir\n$ git commit\n\nAnd I was surprised that the subdir retained files that had been added\nsince <revision>. To get a clean revert, I had to:\n\n$ git rm -r /path/to/subdir\n$ git checkout <revision> -- /path/to/subdir\n$ git commmit\n\nAnd I'm wondering if requiring the \"rm\" first is bug or a feature. On\nthe one hand, in retrospect I understand why it's needed, but otoh, it\ndid catch me off guard the first time.\n\nj.\n"}]}