Q:

How to remove commit remotely after another commits

A git status gives me something like this:
commit XXXXX
Author: AAAA
Date:   Thu Feb 4 16:47:06 2016 -0500

commit YYYYY
Author: BBBB
Date:   Thu Feb 4 16:47:05 2016 -0500

commit ZZZZZ
Author: CCCC
Date:   Thu Feb 4 16:47:04 2016 -0500

I only want to remove changes introduced by YYYYY, that is, I want to keep changes introduced by XXXXX.

A:

You can revert the changes introduced by a commit:
git revert YYYYY

This will create a new commit, which is usually preferred over doing a rebase if you have already pushed your changes to a long-living remote branch (such as master).

