Skip to main content
added 91 characters in body
Source Link
Mario Steinitz
  • 4.8k
  • 1
  • 15
  • 34

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

If you are NOT using Composer for dependency management, you can manually clone the module. Every contrib module has a Development section within the sidebar of its project page. Locate the Browse code repository link.

enter image description here

On the bottom of the repository listing, you'll find the public clone URL. For your module, the clone command would be:

git clone https://git.drupal.org/project/video_embed_vidyard.git

You might have to switch to the correct branch after cloning, as some modules still use the 7.x branch as default or did not set any.

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install (until your patch was approved by the maintainers and merged with the module's code base).

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

If you are NOT using Composer for dependency management, you can manually clone the module. Every contrib module has a Development section within the sidebar of its project page. Locate the Browse code repository link.

enter image description here

On the bottom of the repository listing, you'll find the public clone URL. For your module, the clone command would be:

git clone https://git.drupal.org/project/video_embed_vidyard.git

You might have to switch to the correct branch after cloning, as some modules still use the 7.x branch as default or did not set any.

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install.

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

If you are NOT using Composer for dependency management, you can manually clone the module. Every contrib module has a Development section within the sidebar of its project page. Locate the Browse code repository link.

enter image description here

On the bottom of the repository listing, you'll find the public clone URL. For your module, the clone command would be:

git clone https://git.drupal.org/project/video_embed_vidyard.git

You might have to switch to the correct branch after cloning, as some modules still use the 7.x branch as default or did not set any.

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install (until your patch was approved by the maintainers and merged with the module's code base).

Add description for manual cloning.
Source Link
Mario Steinitz
  • 4.8k
  • 1
  • 15
  • 34

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

If you are NOT using Composer for dependency management, you can manually clone the module. Every contrib module has a Development section within the sidebar of its project page. Locate the Browse code repository link.

enter image description here

On the bottom of the repository listing, you'll find the public clone URL. For your module, the clone command would be:

git clone https://git.drupal.org/project/video_embed_vidyard.git

You might have to switch to the correct branch after cloning, as some modules still use the 7.x branch as default or did not set any.

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install.

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install.

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

If you are NOT using Composer for dependency management, you can manually clone the module. Every contrib module has a Development section within the sidebar of its project page. Locate the Browse code repository link.

enter image description here

On the bottom of the repository listing, you'll find the public clone URL. For your module, the clone command would be:

git clone https://git.drupal.org/project/video_embed_vidyard.git

You might have to switch to the correct branch after cloning, as some modules still use the 7.x branch as default or did not set any.

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install.

Source Link
Mario Steinitz
  • 4.8k
  • 1
  • 15
  • 34

The command git diff always creates a diff (patch) for the current repository you are working with. If you want to create a patch for a certain module, but get a diff with full paths including your Drupal root, it's very likely that you are either

(a) not within the directory of the module's Git repository, or

(b) your module is not a git repository, thus Git is using the next repository it finds while traversing up the folders.

How to fix it?

If you want to create a diff using git diff,

(1) make sure you are using a version of the module that has been cloned from a Git repository. When using Composer for dependency management and your module is a contrib module, you can do so by requiring the dev version of the module, e.g. with your video_embed_vidyard module:

composer require "drupal/video_embed_vidyard:1.x-dev"

Make sure to backup your applied changes first to another location, as running the above command will most likely overwrite them; then re-apply them before proceeding with step (2).

(2) make sure to run git diff from within the module root (Git repository root of the module), not the Drupal root:

cd docroot/modules/contrib/video_embed_vidyard
git diff > ../video_embed_vidyard.patch

This will save your patch in your contrib folder. If you intend to send this patch to the Drupal issue queue of this module, you should also include the issue number in the name of the patch file.

(3) [optional] once again, if you are using Composer for dependency management (highly suggested for Drupal 8), then post your patch to the drupal.org issue queue and also enable patching (cweagans/composer-patches) and include the patch in your composer.json. This ensures your changes being applied to your version of the module every time you are running a Composer install.