Skip to content

Instantly share code, notes, and snippets.

@imeredith
Created April 27, 2012 01:20
Show Gist options
  • Select an option

  • Save imeredith/2504809 to your computer and use it in GitHub Desktop.

Select an option

Save imeredith/2504809 to your computer and use it in GitHub Desktop.
revert changes by a specific user and cherry-pick the rest
This is what I did to revert a lot of changes I had made to a branch over a 2 week period, but still keep other commits that weren't mine.
git branch old-master
git reset <commitId> --hard
for i in `git log master..old-master | grep -v "Author: Ivan Meredith" |grep -B 1 Author |grep commit | awk '{print $2}'`|tail -r; do git cherry-pick $i;done
git push origin master --force
git push origin old-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment