How can I disable the bash-completion like mode in the shell-command mini-buffer?

E.g. with M-! and then git diff > <tab>, emacs shows a list of branches while I expect filename expansion. Ditto after git pull /<tab>; I do not want to expand git remotes there but filenames.

Seen with 'emacs -Q' (29.1)

1 Answer 1


First of all, when I run the commands git diff > <tab>, I do get the filenames in the completion buffer. Picture of the filename in the completion buffer when I run the command.

The completion system for M-x shell-command uses pcomplete by default. The completion backend is explicitly stored in the function pcomplete/git. If you want to disable completion for git, then you can redefine the function pcomplete/git to return nil, ex.

(defun pcomplete/git ()

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.