1

current state:
I have a checkout version, on top of which, I have cherry picked various other commits (lets say 4-5 commits), which are some fixes.
Now, I have to validate other fix without loosing my last working state. I therefore have cherry picked a commit-id (let us say X). And after my validation, I would just want to undo commit-id-X cherry-pick, but other cherry picks should stay intact.

Please suggest, if Git supports some command to do this job directly.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
parasrish
  • 3,864
  • 26
  • 32
  • `git reset HEAD^ --hard` to move your current branch back to the previous commit. – ElpieKay Sep 22 '16 at 06:15
  • but i had been applying my cherry-picks with --no-commit option. And now, if I reset --hard, will it not reset everything? – parasrish Sep 26 '16 at 15:19
  • I checked the log history, and then I could see all the cherry-picked commits in there. Since, my last cherry-pick was the one, that I wanted to ditch. I did `git reset --soft HEAD~`. And hence, only the last cherry-pick (local commit) was discarded, and rest all intact. – parasrish Nov 09 '16 at 08:20
  • Does this answer your question? [How to undo a successful "git cherry-pick"?](https://stackoverflow.com/questions/30986376/how-to-undo-a-successful-git-cherry-pick) – frederj Dec 12 '19 at 21:05

1 Answers1

0

but I had been applying my cherry-picks with --no-commit option

Then you can revert with the same option the commit X previously cherry-picked:

git revert --no-commit X

git revert will reverse the effect of commit X (and only X), and the --no-commit option will allow to apply the changes necessary to revert the named commit to the working tree and the index, but does not make the commit.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250