@@ -139,3 +139,64 @@ details on working with remotes see :ref:`Remotes`.
139139 repo-path : cpputest/cpputest
140140
141141 .. scenario-include :: ../features/journey-basic-usage.feature
142+
143+ My first patch
144+ -----------------
145+ Sometimes you need to patch a dependency to get it working with your project.
146+ *Dfetch * supports creating and applying patches after fetching the dependency.
147+
148+ Given you have fetched ``dfetch-org/test-repo `` and you need to apply a patch.
149+ First commit the fetched version to your version control system. This provides
150+ *Dfetch * a reference point.
151+
152+ .. code-block :: console
153+
154+ git add ext/test-repo-tag
155+ git commit -m "Add test-repo-tag v2.0"
156+
157+ Then you can work on the files inside ``ext/test-repo-tag ``, once you are happy
158+ you can run ``dfetch diff `` to create a patch file with respect to the committed
159+ version.
160+
161+ .. code-block :: console
162+
163+ dfetch diff
164+
165+ This patch file can now be applied automatically by *Dfetch * in next updates.
166+ Add it to your manifest as shown below.
167+
168+ .. code-block :: yaml
169+
170+ manifest :
171+ version : ' 0.0'
172+
173+ remotes :
174+ - name : github
175+ url-base : https://github.com/
176+
177+ projects :
178+ - name : ext/test-repo-tag
179+ repo-path : dfetch-org/test-repo
180+ patch : ext-test-repo-tag.patch
181+
182+ - name : cpputest
183+ repo-path : cpputest/cpputest
184+
185+ To test the patch, update the project again but with the ``-f `` option to force
186+ overwriting the local changes. The local changes will be lost but the patch will
187+ be applied.
188+
189+ .. code-block :: console
190+
191+ dfetch update -f ext/test-repo-tag
192+
193+ Now all changes can be amended to the last committed version including the patch.
194+
195+ .. code-block :: console
196+
197+ git add ext/test-repo-tag ext-test-repo-tag.patch
198+ git commit --amend -no-edit
199+
200+ For more details on working with patches see :ref: `Diff ` and :ref: `Patch `.
201+
202+ .. scenario-include :: ../features/journey-basic-patching.feature
0 commit comments