I have a similar question. Below is my exploration process and results.
Reading the magit-rebase-autosquash
function shows that the rebase commit is hardcoded with :merge-base
, which is the HEAD of the upstream branch in magit-rebase-interactive-1
.
I think the intention is to avoid inconsistencies between the local and upstream commits.
(defun magit-rebase-autosquash (args)
"Combine squash and fixup commits with their intended targets."
(interactive (list (magit-rebase-arguments)))
(magit-rebase-interactive-1 :merge-base
(nconc (list "--autosquash" "--keep-empty") args)
"Type %p on a commit to squash into it and then rebase as necessary,"
"true" nil t))
If we want to autosquash on any commit, we should press r -a i
, and C-c C-c
directly, as -a Autosquash
will automatically adjust the commits that need to be squashed, so we only need to confirm (C-c C-c
) directly.