1 <?xml version='
1.0' encoding='utf-
8'
?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8"/>
5 <title>EGit User Guide - Patches
</title>
6 <link type=
"text/css" rel=
"stylesheet" href=
"../../book.css"/>
9 <table class=
"navigation" style=
"width: 100%;" border=
"0" summary=
"navigation">
11 <th style=
"width: 100%" align=
"center" colspan=
"3">Patches
</th>
14 <td style=
"width: 20%" align=
"left">
15 <a href=
"Tags.html" title=
"Tags">
16 <img alt=
"Previous" border=
"0" src=
"../../images/prev.gif"/>
19 <td style=
"width: 60%" align=
"center"></td>
20 <td style=
"width: 20%" align=
"right">
21 <a href=
"Managing-Repositories.html" title=
"Managing Repositories">
22 <img alt=
"Next" border=
"0" src=
"../../images/next.gif"/>
27 <td style=
"width: 20%" align=
"left" valign=
"top">Tags
</td>
28 <td style=
"width: 60%" align=
"center"></td>
29 <td style=
"width: 20%" align=
"right" valign=
"top">Managing Repositories
</td>
32 <h1 id=
"Patches">Patches
</h1>
33 <h2 id=
"Creating_Patches">Creating Patches
</h2>
34 <p>"A patch is a piece of software designed to fix problems with, or update a computer program or its supporting data" (wikipedia). A patch file contains a description of changes of a set of resources which can be automatically applied to another eclipse workspace or git repository.
</p>
35 <p>The patch formats used by eclipse (Team
> Apply Patch) and by git (git apply or git am on the command line) are different. It is possible to create both types of a patch in EGit.
</p>
36 <h3 id=
"Create_a_Patch_from_a_Commit">Create a Patch from a Commit
</h3>
37 <p>This is the most common use case for a distributed versioning system. A developer commits a change on a local feature or bugfix branch and wants to export this change into a patch file.
</p>
38 <p>It can be done from the history view:
</p>
40 <img border=
"0" src=
"images/PatchContextMenu.png"/>
42 <p>The patch file will contain the difference between the commit and its parent in the history view. Note that the filter of the history view applies also for patch creation.
</p>
43 <h3 id=
"Patch_Wizard">Patch Wizard
</h3>
44 <p>The Wizard consists of two pages. Page one lets you select the location of the patch:
</p>
46 <img border=
"0" src=
"images/PatchWizardPage1.png"/>
48 <p>The name of the patch file is created from the first line of the commit message.
</p>
49 <p>On the second page you can change the patch format.
</p>
50 <p>Currently there is one check box:
"Export in git patch format".
</p>
52 <li>If you do not check it (this is the default) the patch can be applied with the eclipse
"Apply Patch... " wizard. The paths are relative to the eclipse projects and do not contain prefixes (like
"git format-patch --no-prefix" on the git command line).
</li>
53 <li>If you check it the patch will look like the result of
"git format-patch --no-stat" on the git command line.
</li>
55 <h2 id=
"Applying_Patches">Applying Patches
</h2>
56 <p>Currently it s not possible to apply patches in git format. It is possible to apply patches using the standard eclipse format using Team
> Apply Patch...
</p><hr/>
57 <table class=
"navigation" style=
"width: 100%;" border=
"0" summary=
"navigation">
59 <td style=
"width: 20%" align=
"left">
60 <a href=
"Tags.html" title=
"Tags">
61 <img alt=
"Previous" border=
"0" src=
"../../images/prev.gif"/>
64 <td style=
"width: 60%" align=
"center">
65 <a href=
"User-Guide.html" title=
"EGit User Guide">
66 <img alt=
"EGit User Guide" border=
"0" src=
"../../images/home.gif"/>
69 <td style=
"width: 20%" align=
"right">
70 <a href=
"Managing-Repositories.html" title=
"Managing Repositories">
71 <img alt=
"Next" border=
"0" src=
"../../images/next.gif"/>
76 <td style=
"width: 20%" align=
"left" valign=
"top">Tags
</td>
77 <td style=
"width: 60%" align=
"center"></td>
78 <td style=
"width: 20%" align=
"right" valign=
"top">Managing Repositories
</td>