-1

We know we can do cherry-pick which is very useful.

git cherry-pick <commit-number>

But can we do something like cherry-remove in Git? Though not, can someone suggest a set of git commands to accomplish similar behavior?

Suppose we already committed a set of commits and at the end of the day, we realize that one of the commits was nonsense.

Note: Given that, there is no chance of having conflict while reverting the code. Assume the commit is totally not linked with any other code changes.

Niraj
  • 517
  • 1
  • 5
  • 14
  • 1
    Consider `git revert` or, as in [user3699701's answer](https://stackoverflow.com/a/70675976/1256452), interactive rebase. – torek Jan 12 '22 at 05:20
  • https://stackoverflow.com/search?q=%5Bgit%5D+remove+old+commits – phd Jan 12 '22 at 05:35

1 Answers1

2

This seems like a rebase interactive scenario were you use drop to remove the "nonsense" commit.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 12 '22 at 05:29