How to generate patches with git format-patch: Difference between revisions
Content added Content deleted
imported>Jacquiesue No edit summary |
(remove dash) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 17: | Line 17: | ||
</li> |
</li> |
||
<li>Generate a patch using <code>git |
<li>Generate a patch using <code>git format-patch</code> |
||
<pre> |
<pre> |
||
Line 33: | Line 33: | ||
= See also = |
= See also = |
||
*[[Openhatch git workflow]] |
*[[Openhatch git workflow]] |
||
*[[How we handle patches]] |
|||
[[Category:Hacking_OpenHatch]] |
[[Category:Hacking_OpenHatch]] |
||
[[Category:Git_OpenHatch]] |
Latest revision as of 01:55, 6 April 2012
git-format-patch
prepares e-mail-ready version of patches. In its basic invocations, it will create a .patch
file per commit, of the form 000X.First_line_of_commit_message.patch
, where X is the number of the commit in the commit series.
Here's an example of using git-format-patch with OpenHatch:
- Add a commit on your development branch
oh-mainline$ git branch * Issue-#344 master oh-mainline$ touch new_file oh-mainline$ git add new_file oh-mainline$ git commit -m "Test commit"
- Generate a patch using
git format-patch
oh-mainline$ git format-patch master 0001-Test_commit.patch
What git format-patch master
does is look at the commits between master and your current branch, in this case Issue-#344
, and create a patch file per commit. git format-patch master..Issue-#344
means the same thing: make patches for the commits between master
and Issue-#344
.
http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html has full documentation on git format-patch
.