git format-patch

git

इस्तेमाल

git format-patch [-<n>|<since>] [-o <dir>]

हर commit के लिए एक ईमेल-शैली .patch फ़ाइल लिखता है; format-patch main का मतलब main के बाद के commit हैं, main स्वयं नहीं।

आम विकल्प

विकल्पअर्थ
-<n>the last n commits, e.g. -3
<since>commits after that one, e.g. origin/main
-o <dir>write the files into a directory
--stdoutone mbox stream on standard output
--cover-letteradd a 0000 summary mail
-v <n>mark the series as v<n> of a re-roll
-sadd Signed-off-by

उदाहरण

git format-patch -3

writes 0001- to 0003- patch files for the last three commits

git format-patch origin/main --cover-letter -o outbox/

a mailable series of everything not yet upstream

git format-patch -1 --stdout > fix.patch

one commit as a single patch file

उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. git format-patch क्या करता है?

हर commit के लिए एक ईमेल-शैली .patch फ़ाइल लिखता है; format-patch main का मतलब main के बाद के commit हैं, main स्वयं नहीं।

Q. इसे कैसे लिखें?

git format-patch [-<n>|<since>] [-o <dir>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 7 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।

मिलती-जुलती कमांड

man पेज: man git-format-patch