Obtain and apply a patch file
Download the patch file from the issue, and apply the code changes in the patch to your working directory (the following commands assume you’re in a terminal window in the project’s root directory). There are several alternatives:
- Download the patch file manually from the issue (click the link and save to your local computer). Then:
git apply -v [patch-name].patch
- Use
curl
to download the file, then use git to apply the patch:
curl -O https://www.drupal.org/files/[patch-name].patch git apply [patch-name].patch
Or in a single line:
curl https://www.drupal.org/files/[patch-name].patch | git apply -
- Use
wget
to download the file, then use git to apply the patch:
wget https://www.drupal.org/files/[patch-name].patch git apply [patch-name].patch
Or in a single line:
wget -q -O - https://www.drupal.org/files/[patch-name].patch | git apply -
- Set up a git alias to download and apply the patch in one command. In
~/.gitconfig
:
[alias] # Download and apply a patch. a = apply --index ac = "!f() { curl $@ | git a; }; f"
Then run git ac https://www.drupal.org/patch-url
Similar Posts:
- How to change Drupal core files
- create media entities and attach them to paragraphs in Drupal 8 & 9
- Error: Class ‘DOMDocument’ not found in Drupal\Component\Utility\Html::load() (line 286 of core/lib/Drupal/Component/Utility/Html.php)
- How to create a custom page programmatically in Drupal 8
- how to install composer latest version
1,238