79635367

Date: 2025-05-23 11:00:08
Score: 1.5
Natty:
Report link

I know, this is an old question, but perhaps this helps someone in a similar situation:

In my case, I wanted to revert an "older" commit, meaning it was already pushed to the repo and already had other commits following it, but still keep its changes to build upon them. The git revert -n <sha> suggested by @WimFeijen didn't really do that.

I basically ended up doing:

git revert <sha>
git cherry-pick --no-commit <sha>
git restore -- .

What does this do? This reverts the commit normally. The cherry-pick of the same commit adds and stages all the changes again without a commit. The following restore unstages all changes so I can stage everything I need myself.

Not as straight-forward as I hoped, but did the trick for me.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @WimFeijen
  • Low reputation (0.5):
Posted by: R. Cocinero