0

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?

Kranach
  • 740
  • 2
  • 9
  • 24

1 Answers1

1

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.

Community
  • 1
  • 1
eckes
  • 64,417
  • 29
  • 168
  • 201
  • eh, since there were already some patchsets/commits that followed gerrit conventions pushed by other devs we decided to not mess with configuration and squash those commits into another patchset. So used interactive rebasing after all. Took almost half an hour but well, could be worse. – Kranach Feb 19 '14 at 09:22