2021年1月23日星期六

How to redo a Git commit which had been reverted in a batch revert commit

In a branch, say, there are 25 commits: A <- B <- C ... X <-Y. I once reverted C to Y in a batch commit by:

git revert -n C^..Y  git commit -a -m "xxx"  

This would be a new big commit Z which reverts C to Y.

Then I need to redo C to F due to some reason. I tried:

git cherry-pick C^..F  

But I got this message:

Already up to date!  The previous cherry-pick is now empty, possibly due to conflict resolution.  

No change to my work space or git log. I think the reason is that, C to F are already in this branch, so cherry-pick just ignores them though the last commit Z had reverted C to Y. What's the right way to recommit C to F?

https://stackoverflow.com/questions/65867023/how-to-redo-a-git-commit-which-had-been-reverted-in-a-batch-revert-commit January 24, 2021 at 12:03PM

没有评论:

发表评论