How to generate patches with git format-patch: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Jesstess
No edit summary
(remove dash)
 
(7 intermediate revisions by 5 users not shown)
Line 3: Line 3:
Here's an example of using git-format-patch with OpenHatch:
Here's an example of using git-format-patch with OpenHatch:


<ol>
# Add a commit on your development branch

<li>Add a commit on your development branch


<pre>
<pre>
oh-mainline$ git branch
oh-mainline$ git branch
* Issue-#344
* jesstess
master
master
oh-mainline$ touch new_file
oh-mainline$ touch new_file
Line 13: Line 15:
oh-mainline$ git commit -m "Test commit"
oh-mainline$ git commit -m "Test commit"
</pre>
</pre>
</li>


# Generate a patch using <code>git-format-patch</code>
<li>Generate a patch using <code>git format-patch</code>


<pre>
<pre>
Line 20: Line 23:
0001-Test_commit.patch
0001-Test_commit.patch
</pre>
</pre>
</li>

</ol>

What <code>git format-patch master</code> does is look at the commits between master and your current branch, in this case <code>Issue-#344</code>, and create a patch file per commit. <code>git format-patch master..Issue-#344</code> means the same thing: make patches for the commits between <code>master</code> and <code>Issue-#344</code>.

http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html has full documentation on <code>git format-patch</code>.


= See also =
What <code>git format-patch master</code> does is look at the commits between master and your current branch, in this case <code>jesstess</code>, and create a patch file per commit. <code>git format-patch master..jesstess</code> means the same thing: make patches for the commits between <code>master</code> and <code>jesstess</code>.
*[[Openhatch git workflow]]
*[[How we handle patches]]


[[Category:Hacking_OpenHatch]]
http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html has full documentation on <code>git-format-patch</code>.
[[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:

  1. 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"
    
  2. 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.

See also