@@ -1672,8 +1672,17 @@ _git_commit ()
" "" "${cur##--cleanup=}"
return
;;
+ --fixup=amend:*|--fixup=reword:*)
+ __git_complete_refs --cur="${cur#*:}"
+ return
+ ;;
+ --fixup=*)
+ __git_complete_refs --cur="${cur#*=}"
+ __gitcomp_direct_append "$(compgen -W "amend: reword:" "${cur#*=}")"
+ return
+ ;;
--reuse-message=*|--reedit-message=*|\
- --fixup=*|--squash=*)
+ --squash=*)
__git_complete_refs --cur="${cur#*=}"
return
;;
@@ -1444,6 +1444,41 @@ test_expect_success 'git checkout - with --detach, complete only references' '
EOF
'
+test_expect_success 'git commit - with --fixup=, completes references along with amend: and reword:' '
+ test_completion "git commit --fixup=" <<-\EOF
+ HEAD Z
+ main Z
+ matching-branch Z
+ matching-tag Z
+ other/branch-in-other Z
+ other/main-in-other Z
+ amend:Z
+ reword:Z
+ EOF
+'
+
+test_expect_success 'git commit - with --fixup=amend:, completes references' '
+ test_completion "git commit --fixup=amend:" <<-\EOF
+ HEAD Z
+ main Z
+ matching-branch Z
+ matching-tag Z
+ other/branch-in-other Z
+ other/main-in-other Z
+ EOF
+'
+
+test_expect_success 'git commit - with --fixup=reword:, completes references' '
+ test_completion "git commit --fixup=reword:" <<-\EOF
+ HEAD Z
+ main Z
+ matching-branch Z
+ matching-tag Z
+ other/branch-in-other Z
+ other/main-in-other Z
+ EOF
+'
+
test_expect_success 'setup sparse-checkout tests' '
# set up sparse-checkout repo
git init sparse-checkout &&