Skip to contentSkip to conversation

git-format-patch(1)- add note about creating patch for single commit

PATCH In review Dan McGee 2 participants 4 messages Jun 15, 2016 Documentation

lore
Share & tools
lore

Dan McGee

author
#0 lore raw

PATCH 1/1 git-format-patch(1)- add note about creating patch for single commit

---

I thought this would be helpful because it took me the beter part of an hour to find a solution instead of specifying C~1..C or other crazy things. The current documentation just leaves you hanging when what you really want is just one formatted patch.

If there any suggestions on better wording, feel free to resubmit or whatever- I just felt like this should be documented somewhere.

 Documentation/git-format-patch.txt |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Documentation/git-format-patch.txt +3 -1
index adb4ea7..8518c33 100644
@@ -46,7 +46,9 @@ applies to that command line and you do not get "everything
 since the beginning of the time".  If you want to format
 everything since project inception to one commit, say "git
 format-patch \--root <commit>" to make it clear that it is the
-latter case.
+latter case.  If you want to format only a single commit, say "git
+format-patch <commit>^!" (which excludes all parent revisions of the
+specified commit).
 
 By default, each output file is numbered sequentially from 1, and uses the
 first line of the commit message (massaged for pathname safety) as
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 19 lines · Dan McGee

---

I thought this would be helpful because it took me the beter part of an hour to find a solution instead of specifying C~1..C or other crazy things. The current documentation just leaves you hanging when what you really want is just one formatted patch.

If there any suggestions on better wording, feel free to resubmit or whatever- I just felt like this should be documented somewhere.

 Documentation/git-format-patch.txt |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Documentation/git-format-patch.txt +0 -0
index adb4ea7..8518c33 100644

Documentation/git-format-patch.txt applies to that command line and you do not get "everything · line 54

Quoted 10 lines
Documentation/git-format-patch.txt +3 -1
@@ -46,7 +46,9 @@ applies to that command line and you do not get "everything
 since the beginning of the time".  If you want to format
 everything since project inception to one commit, say "git
 format-patch \--root <commit>" to make it clear that it is the
-latter case.
+latter case.  If you want to format only a single commit, say "git
+format-patch <commit>^!" (which excludes all parent revisions of the
+specified commit).
 
 By default, each output file is numbered sequentially from 1, and uses the
 first line of the commit message (massaged for pathname safety) as

Heh, a more natural way to say that is:

git format-patch -1 $that_one

That uses the first option described in the documentation:

	-<n>::
        	Limits the number of patches to prepare.
author
#2 lore raw
Quoted 34 lines · Junio C Hamano
Quoted 19 lines · Dan McGee

---

I thought this would be helpful because it took me the beter part of an hour to find a solution instead of specifying C~1..C or other crazy things. The current documentation just leaves you hanging when what you really want is just one formatted patch.

If there any suggestions on better wording, feel free to resubmit or whatever- I just felt like this should be documented somewhere.

 Documentation/git-format-patch.txt |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Documentation/git-format-patch.txt +0 -0
index adb4ea7..8518c33 100644

Documentation/git-format-patch.txt applies to that command line and you do not get "everything · line 54

Quoted 10 lines
Documentation/git-format-patch.txt +3 -1
@@ -46,7 +46,9 @@ applies to that command line and you do not get "everything
 since the beginning of the time".  If you want to format
 everything since project inception to one commit, say "git
 format-patch \--root <commit>" to make it clear that it is the
-latter case.
+latter case.  If you want to format only a single commit, say "git
+format-patch <commit>^!" (which excludes all parent revisions of the
+specified commit).
 
 By default, each output file is numbered sequentially from 1, and uses the
 first line of the commit message (massaged for pathname safety) as

Heh, a more natural way to say that is:

Quoted 6 lines

git format-patch -1 $that_one

That uses the first option described in the documentation:

-<n>::
Limits the number of patches to prepare.

Wow, had no idea about that option. :)

Given that I didn't even notice this option when I did go to the manpage, what if my above change was instead reworked a bit:

Quoted 2 lines
Quoted 2 lines
Documentation/git-format-patch.txt +2 -0
+latter case.  If you want to format only a single commit, say "git
+format-patch -1 <commit>" .
#3 lore raw
Quoted 11 lines · Dan McGee
Quoted 8 lines · Junio C Hamano

Heh, a more natural way to say that is:

git format-patch -1 $that_one

That uses the first option described in the documentation:

-<n>::
Limits the number of patches to prepare.

Quoted 6 lines

Wow, had no idea about that option. :)

Given that I didn't even notice this option when I did go to the manpage, what if my above change was instead reworked a bit:

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+latter case.  If you want to format only a single commit, say "git
+format-patch -1 <commit>" .

I thought about it, but saw "formatting three commits" example in the manpage, and stopped there ;-)