With command line git you can use git format-patch [commit_hash] [file]
to generate a patch for a single file. Is there a way to generate a patch in magit for only a single file? I tried marking the files like I would when staging multiple files, but it still created a patch for the whole commit.
1 Answer
Magit supports this now. In the patch popup press = F and then type the name of the file (with completion). You can also input multiple files, separated by comas.
magit-format-patch
doesn't support that, and this isn't an option that you can simply define withmagit-define-popup-option
. I think it's a feature worth proposing on magit's issue tracker.start-process
-- at the very least, someone here could create an interactive function that would gather the commit-sha and filename and plug it into the command-line passed tostart-process
.