I just wanted to know if Magit has this functionality. The reference manual does not have this explicitly so that's why I am asking.

  • @itsjeyd yes, sorry, I was trying out sx.el (the stackexchange client for emacs) and it didn't show any answers. Once I opened the link in a browser I saw it, sorry :( Edit: deleted comment – Lee H Jan 16 '15 at 15:30
  • @LeeH No problem, thanks for following up! :) – itsjeyd Jan 16 '15 at 15:37
  • @LeeH That's very odd. If you run into that problem again please file a bug report. – Malabarba Jan 20 '15 at 20:45
  • @Malabarba I did! Then it was fixed in sx.el and everything works now :) – Lee H Jan 21 '15 at 11:29

You're right, it doesn't seem to be built in. But note that you can run any git subcommand you like from a Magit buffer by pressing :, which is bound to magit-git-command by default:

magit-git-command is an interactive autoloaded compiled Lisp function in magit.el.

(magit-git-command ARGS DIRECTORY)

Execute a Git subcommand asynchronously, displaying the output. With a prefix argument run Git in the root of the current repository. Non-interactively run Git in DIRECTORY with ARGS.

So in order to get a patch for, e.g., the latest commit using git format-patch you can do the following:

: format-patch -1 RET

The output (displayed in the *magit-process* buffer) will look something like this:

  0 git --no-pager -c core.preloadindex=true format-patch -1

Starting with v2.1.0 Magit provides basic support for git format-patch as well as git request-pull. They share a popup, magit-patch-popup, which W is bound to.

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.