Celeb Glow
updates | March 01, 2026

How can I revert the last two commits on my mainline branch without issuing a change request (CR)?

I accidentally committed two changes – let’s say commit98, commit99 — to mainline. So now the mainline branch moved to commit99 from commmit97

I wanted to revert the last two changes and put the mainline back to commit97.

Also I am not supposed to directly push code changes to the repository without a CR (change request).

So, I wanted the changes locally so that I can create a CR (change request).

1

1 Answer

Create a new branch:

git checkout -b some_branch

Then:

git rebase -i the_first_commit_you_want_to_modify^

Then adjust the order of commit.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy