When I run built-in magit commands, they output to the magit-process buffer. How can I do the same with a custom magit command that generates shell output?


You can run one-off commands using the magit-run-popup bound to !. For example, !!ls-files will run git ls-files in the top-level directory of the repo and output the results to the Magit process buffer for that repo.

For writing your own commands, you can use one of Magit's functions for calling Git, picking the variant depending on the type of Git command and whether you are calling it for a return value or for a side-effect. The !! command from above ends up calling (magit-run-git-async "ls-files") in the top-level directory of the repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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