git revert commit/push but keep changes

commit, git, revert

Solution

$ git reset <old-id>    # Undo the commit after old-id
$ git add A             # stage A for a new commit
$ git commit            # make the new commit
$ git push              # push it

Problem

It goes like this: I have files A and B that I modified I'm only suppose to commit and push A, but accidentally committed both and pushed both A and B I did a "git push old-id:master" so on github it shows "Master is now old-id" where old-id is the last commit before me, so i think it's back to before i committed. Question: - On my local, how do i undo the commit that has A and B, and commit only A, and push only A? Note: I do need to keep the changes for both A and B on my local though. The end result should be: - Local - new A and new B - Github - new A and old B

Original source