Background
I am using Gerrit. One commit C has been merged into branch dev and needed to be cherry-picked into branch main. One of my colleagues have tried to cherry pick using below command.
git checkout main
git cherry-pick `C`
He pushed in Gerrit and after some review he messed up and end up abandoning the commit C on branch main. Now, when I am trying freshly to cherry pick the same commit. Gerrit is rejecting the commit to push on branch main, saying that the commit is already closed. As a policy we can not push as new commit rather we must cherry pick for keeping branch histories.
To ssh://gerrit.company.net:29417/project
! [remote rejected] HEAD -> refs/for/main (change https://gerrit.company.net/open/426535 closed)
error: failed to push some refs to 'ssh://[email protected]:29417/project'
How can I deal with this situation?
Gerrit is rejecting the push because there is a change (426535) that (a) has the same Change-Id, (b) is for the same branch (
main), and (c) is closed.From https://gerrit-review.googlesource.com/Documentation/error-change-closed.html: