0

Suppose I've working code in my master branch at PUSH A.

I've pushed some wrong code in my master, say PUSH B

Over my wrong commit, there is one more push. PUSH C

Now I want to revert my code, but keep the correct changes of PUSH C in the master.

enter image description here

reiley
  • 3,759
  • 12
  • 58
  • 114

1 Answers1

1

Use git revert command to revert any commit you don't want.

git revert <commit id>

Additionally, if there was a PR raised to merge "PUSH B" then you also get "revert" option in the merged PR, which will ease your work.

Let me know if this helps!

Milind Agrawal
  • 2,724
  • 1
  • 13
  • 20