0

I wanted to commit B to the remote master branch whose head is at A. I had previously committed code saved locally (say X). When I pushed B to the master this caused the following:

 A-----B
    /
X--/

I just want B to committed. B should be on top of A and revert X commit. Can someone help me on this?

Siddharthan Asokan
  • 4,321
  • 11
  • 44
  • 80

1 Answers1

0

You can rebase your branch on the commit A. Then revert the commit X.

To rebase -

git rebase <SHA of commit A>

You might need to force push if you want to change something that's already been pushed to the remote.

gravetii
  • 9,273
  • 9
  • 56
  • 75