Skip to content

Commit

Permalink
Fix git-rebase -i to allow squashing of fast-forwardable commits
Browse files Browse the repository at this point in the history
Without this change the commits will be left standalone, with
duplicated commit message.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Jul 14, 2007
1 parent 9a4cbdc commit 793ad04
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pick_one () {
current_sha1=$(git rev-parse --verify HEAD)
if [ $current_sha1 = $parent_sha1 ]; then
git reset --hard $sha1
test "a$1" = a-n && git reset --soft $current_sha1
sha1=$(git rev-parse --short $sha1)
warn Fast forward to $sha1
else
Expand Down Expand Up @@ -193,14 +194,14 @@ do_next () {
die "Cannot 'squash' without a previous commit"

mark_action_done
failed=f
pick_one -n $sha1 || failed=t
MSG="$DOTEST"/message
echo "# This is a combination of two commits." > "$MSG"
echo "# The first commit's message is:" >> "$MSG"
echo >> "$MSG"
git cat-file commit HEAD | sed -e '1,/^$/d' >> "$MSG"
echo >> "$MSG"
failed=f
pick_one -n $sha1 || failed=t
echo "# And this is the 2nd commit message:" >> "$MSG"
echo >> "$MSG"
git cat-file commit $sha1 | sed -e '1,/^$/d' >> "$MSG"
Expand Down

0 comments on commit 793ad04

Please sign in to comment.