On Mar 31, 10:33 pm, Jeffda <daniel.viviot...@gmail.com> wrote:
> Is it possible to revert a GIT repository to what it was right before
> a specific patch was applied? If so, is it possible to do so with just
> the patch's filename or the patch itself?

Alternatively (to what  Marek discussed), as you mention patches, you
can use the "patch" command itself to revert a specific patch using
its "-R" command-line option.
That is, if you applied a patch foo.patch
$ patch -p1 </tmp/foo.patch
and then decided it was a mistake, revert it by
$ patch -R -p1 </tmp/foo.patch

(If you used `git apply`, the same holds, as it also supports the -R
option with the same meaning.)

Note that if was not the last patch in a series of applied patches, it
might not revert cleanly. In this case you might want to do what Marek
shown to reset the working directory and start from scratch.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to