remove commits from contributor

1.6k Views Asked by At

I have a Git repo with a lot of old commits from a contributor. Those commits do in no way influence the current version of the repo. I would like to remove all the commits from that contributor. How to proceed?

Thanks!

1

There are 1 best solutions below

0
On

The easiest way to do this is with an interactive rebase. Let's say the first commit you want to delete is abc. Do the following: git rebase -i abc^. This will pop up an editor with a list of commits. Delete the lines that contain the commits you want to delete, then save/close the file. Git will then rewrite all of the commits in order, leaving out the ones you deleted.

Note that when you push to the server, you will need to use the --force option to overwrite what is there as well.