Question

I read that I can use git revert to undo a cherry-pick. I tried to cherry-pick a commit from the master branch on a project, but not I realize I don't want to do it. Unfortunately for me, I've already pushed.

What I'm afraid of is if I use git revert, I don't know if it will revert the commit on master too when the PR is merged.

How can I undo the cherry-pick without messing up the master branch after a merge?

This is not intended to be a duplicate, I just want to undo it on the pull request branch and don't want to undo it on master.

Was it helpful?

Solution

Try it. Git is a distributed SCM—you can merge the feature branch into master on your local repository and see what happens without anybody else noticing. (Don't forget to revert your experiments afterwards.) If you want to be extra secure, copy your repository first and try it in the copy.

That said, you are safe. The commit won't be reverted in master.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top