How to revert a folder to a particular commit by creating a patch
You can use git checkout to update your repository to a specific state.
git checkout e095 -- somefolder
As for your question about generating the diff, that would work too. Just generate the diff to go from your current state back to e095
:
git diff 89cd..e095 -- somefolder
You can use git reset
to reset the index which will also include removing files that were added in more recent commits (git checkout
on it's own doesn't do this):
git reset e095 -- somefolder
However git reset
doesn't update the working copy and the --hard
option doesn't work with folders. So then use git checkout
to make the working copy the same as the index:
git checkout -- somefolder
and then if you also want to remove any files added you also need todo:
git clean -fd somefolder