1

I'm running the latest emacs 31 and the latest Magit.

In a project, I have several commits to rebase, and one is a fixup and is marked fixup!. It points to an existing commit made earlier in the day.

When viewing the log, I press 'r' then 'f', and nothing happens. I've tried this with the cursor on the parent, the fixup target, the fixup itself, and other random commits. The command being run according to the Messages buffer is something like git rebase -i --autosquash --keep-empty --autostash 8691788ab886d88f78d0dbb59d6f0841a1e6ed38 where that commit hash is the most recent one at the top of the log.

I was expecting to see the fixup commit disappear after being squashed into the target commit, or at least be dropped into an interactive rebase session.

Poking around the Magit code, I see a message that never appears while using the command: 'Type %p on a commit to squash into it and then rebase as necessary,' so this code is not reached for some reason.

What am I doing wrong?

1 Answer 1

0

I have a similar question. Below is my exploration 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.