Pergunta

My team has started to use gerrit and set up new repo for it, copied from the old one. It is now a couple of commits behind of what old one was. I merged all the commits locally, however I cannot push them, because gerrit requires every commit to have change-id in message footer something like:

Change-Id: e448fed026e072f547ac0f6f9b144f8aeb8a9847

Is there some quick way to append such a footer to commit message of X last commits?

Foi útil?

Solução

Not exactly in one go, but it is possible with git rebase:

  1. start the rebase with git rebase --interactive <LAST_PUSHED_VERSION>
  2. In the editor coming up, change pick to r or reword
  3. save the file and exit the editor
  4. now, every commit message you selected to reword will come up in your editor. Correct the message, save the file and close the editor

Once rebasing is finished, you corrected all your commit messages you wanted to.

However, since this is a bit of effort, best solution would be to tell Gerrit to accept commits without Change-IDs as supposed by HiB in his comment.

See also Gerrit error when Change-Id in commit messages are missing for a discussion on this topic.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top