5 TODO_EXTRA
="$(git rev-parse --git-dir)/todo-extra"
7 # Rebase 'devel' on top of 'junio/next', the merging the old state of
8 # 'devel' with the merge strategy 'ours' to enable a fast-forward.
10 THIS
="$(cd "$
(dirname "$0")" && pwd)/$(basename "$0")" &&
12 case "$(git rev-parse --symbolic-full-name HEAD)" in
14 test "$(git rev-parse HEAD)" = "$(git rev-parse origin/devel)" ||
15 test "$(git rev-parse devel@{1})" = "$(git rev-parse origin/devel)" ||
{
16 echo "Your 'devel' is not up-to-date!" >&2
22 echo "Not on 'devel'!" >&2
27 # Find old rebasing merge, if any
31 MERGE
=$
(git rev-list
--parents $TO.. |
sed -n 's/ .* .*//p' |
head -n 1)
32 if test "$(git rev-parse $MERGE:)" = "$(git rev-parse "$MERGE^
:")"
34 ORIG_HEAD
=$
(git rev-parse HEAD
) &&
35 # Find prior merges to $TO
36 EXCLUDE
=$
(git rev-list
--parents $TO..
$MERGE^ |
37 sed -n 's/^\([^ ]*\) .* .*/^\1/p') &&
38 # Get commits from previous rebasing merge
39 git rev-list
--pretty=oneline
--abbrev-commit --abbrev=7 --reverse \
40 --no-merges $TO..
$MERGE^
$EXCLUDE |
41 sed 's/^/pick /' > "$TODO_EXTRA" &&
42 TMP_EDITOR
="$(git rev-parse --git-dir)/rebasing-editor.sh" &&
43 cat > "$TMP_EDITOR" << EOF &&
47 cat "\$1" >> "$TODO_EXTRA" &&
48 mv "$TODO_EXTRA" "\$1"
50 exec "$(git var GIT_EDITOR)" "\$@"
52 if GIT_EDITOR
="$TMP_EDITOR" git rebase
-i $MERGE --onto $TO
54 git merge
-s ours
-m "Rebasing merge to $TO" $ORIG_HEAD
58 After the rebase, call 'git merge -s ours $ORIG_HEAD' manually