|
46 | 46 | for files in the directory ``Core/MyModule/MySubmodule/`` and your current working directory is ``Core/MyModule/``. |
47 | 47 | The correct command would be: |
48 | 48 |
|
49 | | - ``git apply --verbose --directory='Core/MyModule/MySubModule' MySubmodule.patch`` |
| 49 | + ``git apply --verbose --directory='Core/MyModule/MySubmodule' MySubmodule.patch`` |
50 | 50 |
|
51 | 51 | Updating the patch |
52 | 52 | ====================== |
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 |
57 | 79 |
|
58 | 80 | """ |
59 | 81 |
|
|
0 commit comments