Q:

Remove git commit

I am having trouble to find a proper solution to my problem: I am writing some code for a project. Every week I get some new features I have to implement and it turned out a certain feature I've already added a month ago can be dropped and removed from the code basis. I know exactly which commit is responsible for that. Is there a command in git to drop that specific commit but leaving the adjustments to the code I have made in the commits afterwards unchanged?
All the best,
David

A:

Two ways.
git rebase -i 'commit to be dropped'
requires a git push -f if the commit is already at server.
This will entirely remove the commit from historic, may be dangerous if your repository is shared, or even forbidden by the server. I recommend you to never do this if the commit is already pushed.
Or you may use
git revert 'commit to be reverted'
This will create a new commit that undo your modifications.

