Skip to content

Commit 749cfa7

Browse files
committed
Document updating patch
1 parent ab845c3 commit 749cfa7

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

dfetch/commands/diff.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,36 @@
4646
for files in the directory ``Core/MyModule/MySubmodule/`` and your current working directory is ``Core/MyModule/``.
4747
The correct command would be:
4848
49-
``git apply --verbose --directory='Core/MyModule/MySubModule' MySubmodule.patch``
49+
``git apply --verbose --directory='Core/MyModule/MySubmodule' MySubmodule.patch``
5050
5151
Updating the patch
5252
======================
53-
If you have further changes to a project with a patch, you can update the patch by first reversing the patch, using the
54-
``--apply`` and ''--directory`` arguments as shown above. To reverse the patch you also require the ``-R``. This will
55-
return the project to the state before the patch was applied. If you commit this base project, then re-apply the patch
56-
and any additional changes, you can generate a new patch with the latest state.
53+
If you have further changes to a project with a patch, you can update the patch by first reversing the patch, using
54+
``apply`` and with the ``--directory`` argument as shown above. To reverse the patch you also require the ``-R``.
55+
This will return the project to the state before the patch was applied. You can then stage the project and re-apply
56+
the patch to the project to have an editable patch.
57+
58+
.. code-block:: sh
59+
60+
# First apply the reverse patch
61+
git apply --verbose --directory='some-project' -R some-project.patch
62+
63+
# Stage the project in its unpatched state
64+
git add some-project
65+
66+
# Re-apply the patch
67+
git apply --verbose --directory='some-project' some-project.patch
68+
69+
Now you can make further changes to the project, and re-generate the patch using the raw git command as shown below.
70+
71+
.. code-block:: sh
72+
73+
# Generate the patch from the directory again
74+
cd some-project
75+
git diff --relative --binary --no-ext-diff --no-color . > ../some-project.patch
76+
77+
# Force a fetch and update the patch to test your changes
78+
dfetch update -f some-project
5779
5880
"""
5981

0 commit comments

Comments
 (0)