Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create patch for staged files with Magit

Tags:

emacs

patch

magit

How could I create patch for staged files with Magit?

I tried "W p", when prompt "Format range or commit(master)", I am not sure what should I put there, I tried HEAD..master, but it doesn't create any patch.

I tried command line: "git diff --cached > my.patch" create what I expected.

How could I create the same patch with Magit?

like image 506
Enze Chi Avatar asked Dec 12 '25 00:12

Enze Chi


1 Answers

While I haven't found a way to create a patch directly, you can certainly make a patch from any diff file!

From magit-diff, you can run W then s, or magit-patch-save to save the diff as a patch. You can customise your diff so that the patch matches just the changes you wish to share.

like image 187
John Hamelink Avatar answered Dec 14 '25 16:12

John Hamelink



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!