[coreboot] git/gerrit question

Peter Stuge peter at stuge.se
Tue Oct 4 19:06:07 CEST 2011


Oskar Enoksson wrote:
> I'm trying to upload a patch. It seems that for some reason
> "gerrit" requires a "signed-off-by" line in every single local
> commit in order to push it to the remote location.

More background at

> I'm able to "amend" such a line to the very last commit, but I
> can't find a way to do it on the previous commits. How can I do it?
> Do I have to start from scratch?

Not at all. You'll use the git feature called interactive rebase, to
rewrite your history. I recommend reading man git-rebase under
"INTERACTIVE MODE" and/or http://progit.org/book/ch6-4.html for good
descriptions of how this works.

You run git rebase -i commithash_before_the_first_you_want_to_change
and get an editor where you first create a script for git telling it
what to do for each commit following the commit you specified.
Default is to pick every commit unchanged. Change pick to edit, or
simply e, for each line, save and exit. git rolls back history,
applies the first commit, and exits to a shell. You can now git
commit --amend -s -C HEAD to amend that commit to include a signoff.

Remember to configure your user name and email address in git first:
git config --global user.name 'Oskar Enoksson'
git config --global user.email your at email.here

If you had not done this before committing the first time, then you
should also add --author='Oskar Enoksson <your at email.here>' to the
git commit --amend -s -C HEAD command, in order to also fix the
authorship information while you are iterating over the patches
anyway. Use git show to review the commit. Then run
git rebase --continue

to have git perform the next command in the rebase script you created
at the beginning. Once you've iterated over all commits git should
report success.

Note that when a branch with multiple commits which gerrit has not
seen is pushed to gerrit, gerrit interprets this to mean that the
commits in this branch all belong together as one unity, there is a
dependence documented for each commit. This is not a hard dependency,
the commits can also be included in the public repo out of order from
gerrit, but for maximum clarity it is better to push independent
patches separately, e.g. by having different branches locally, based
on the current public repo and with just one new commit on each. It's
not a too big deal if this should end up wrong in gerrit, especially
on the first push, but keep it in mind for the future if there are
independent commits. (This is just a note, I don't know if you do
have independent commits or not.)

Hope this helps


More information about the coreboot mailing list