@@ -493,25 +493,28 @@ do_next () {
493
493
author_script_content=$( get_author_ident_from_commit HEAD)
494
494
echo " $author_script_content " > " $author_script "
495
495
eval " $author_script_content "
496
- output git reset --soft HEAD^
497
- pick_one -n $sha1 || die_failed_squash $sha1 " $rest "
496
+ if ! pick_one -n $sha1
497
+ then
498
+ git rev-parse --verify HEAD > " $amend "
499
+ die_failed_squash $sha1 " $rest "
500
+ fi
498
501
case " $( peek_next_command) " in
499
502
squash|s|fixup|f)
500
503
# This is an intermediate commit; its message will only be
501
504
# used in case of trouble. So use the long version:
502
- do_with_author output git commit --no-verify -F " $squash_msg " ||
505
+ do_with_author output git commit --amend -- no-verify -F " $squash_msg " ||
503
506
die_failed_squash $sha1 " $rest "
504
507
;;
505
508
* )
506
509
# This is the final command of this squash/fixup group
507
510
if test -f " $fixup_msg "
508
511
then
509
- do_with_author git commit --no-verify -F " $fixup_msg " ||
512
+ do_with_author git commit --amend -- no-verify -F " $fixup_msg " ||
510
513
die_failed_squash $sha1 " $rest "
511
514
else
512
515
cp " $squash_msg " " $GIT_DIR " /SQUASH_MSG || exit
513
516
rm -f " $GIT_DIR " /MERGE_MSG
514
- do_with_author git commit --no-verify -e ||
517
+ do_with_author git commit --amend -- no-verify -F " $GIT_DIR " /SQUASH_MSG -e ||
515
518
die_failed_squash $sha1 " $rest "
516
519
fi
517
520
rm -f " $squash_msg " " $fixup_msg "
@@ -748,21 +751,19 @@ In both case, once you're done, continue with:
748
751
fi
749
752
. " $author_script " ||
750
753
die " Error trying to find the author identity to amend commit"
751
- current_head=
752
754
if test -f " $amend "
753
755
then
754
756
current_head=$( git rev-parse --verify HEAD)
755
757
test " $current_head " = $( cat " $amend " ) ||
756
758
die " \
757
759
You have uncommitted changes in your working tree. Please, commit them
758
760
first and then run 'git rebase --continue' again."
759
- git reset --soft HEAD^ ||
760
- die " Cannot rewind the HEAD"
761
+ do_with_author git commit --amend --no-verify -F " $msg " -e ||
762
+ die " Could not commit staged changes."
763
+ else
764
+ do_with_author git commit --no-verify -F " $msg " -e ||
765
+ die " Could not commit staged changes."
761
766
fi
762
- do_with_author git commit --no-verify -F " $msg " -e || {
763
- test -n " $current_head " && git reset --soft $current_head
764
- die " Could not commit staged changes."
765
- }
766
767
fi
767
768
768
769
record_in_rewritten " $( cat " $state_dir " /stopped-sha) "
0 commit comments