Reputation: 47472
I have one GIT repository in which a number of users (Say A, B, .....X) committed the file. I want to delete or revert all the files which are committed by the User 'X'.
Is it possible or do I have to do that manually?
Upvotes: 2
Views: 770
Reputation: 363547
Try this:
git log --author=X --format="%H" | xargs git revert
The first part of the pipeline produces all SHA1s of commits where the username matches the regular expression (!) X
; the second part calls a git revert
on those commits. If one of the commits fails to revert cleanly, though, you might want to just walk through the output of
git log --author=X --oneline
and revert by hand.
Upvotes: 3
Reputation: 7853
I believe, you can use git revert for this. See the git manual section on this for more information.
The gist is that you can say:
git revert Where is the id of the commit you'd like to undo, and it will try to undo it.
Upvotes: 0