3 # rebase.sh - rebase helper script
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; version 2 of the License.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
15 # Adapt to your remote branch:
16 BRANCH
="cros/chromeos-2015.07"
18 # When pulling in patches from another tree from a gerrit repository,
19 # do the following at the end of a larger cherry-pick series:
21 # git checkout -b upstreaming
23 # git rebase -i --exec util/gitconfig/rebase.sh master
24 # Alternatively, you can run util/gitconfig/rebase.sh after every
25 # individual cherry-pick.
28 git log
-n 1 |
grep "^ " | cut
-c5-
31 CHID
=$
( commit_message |
grep -i "^Change-Id: I" )
32 CID
=$
( git log
-n1 --grep "^$CHID$" --pretty=%H
$BRANCH )
33 GUID
="$(git config user.name) <$(git config user.email)>"
35 # TBD: Don't add Original- to empty lines, and possibly make script more
36 # solid for commits with an unexpected order of meta data lines.
38 commit_message |
tac |
awk '/^$/ {
40 print "Original-Commit-Id: '"$CID"'\nSigned-off-by: '"$GUID"'";
47 }' |
tac | git commit
--amend -F -