Error applying patch with Git I have read different SE posts and Drupal.org posts about applying patches using git but I am getting an error message whenever I try any of the following methods. the error is:


  error: modules/callbacks.inc: No such file or directory


I tried:

curl https://www.drupal.org/files/issues/op_update_should_be_create-2807275-2.patch | git apply -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   668  100   668    0     0   2278      0 --:--:-- --:--:-- --:--:--  2279
error: modules/callbacks.inc: No such file or directory


Also, I downloaded the patch into Drupal root and tried:

git apply -v op_update_should_be_create-2807275-2.patch


The backstory:
I was getting the following errors on my website, which I found this discussion explaining that it was because of Entity API, and I was trying to apply the patch in #2.


  Notice: Undefined property: stdClass::$custom in
  block_block_list_alter() (line 794 of
  /Applications/AMPPS/www/example/docroot/modules/block/block.module).
  Notice: Undefined property: stdClass::$visibility in
  block_block_list_alter() (line 807 of
  /Applications/AMPPS/www/example/docroot/modules/block/block.module).
  Notice: Undefined property: stdClass::$pages in
  block_block_list_alter() (line 817 of
  /Applications/AMPPS/www/example/docroot/modules/block/block.module).


This is my first time trying to apply a patch.
Place op_update_should_be_create-2807275-2.patch into the module folder, in this case being the sites/all/modules/entity folder. 

Then in your terminal cd (change directory) into the module folder.

cd /var/www/drupal/sites/all/modules/entity

then

git apply -v op_update_should_be_create-2807275-2.patch

In the discussion, Fago has commited this patch (2 months ago), but into the 7.x-.1.x only.



So I assume you're trying to patch the stable version, 7.x-1.8.

If you use/download the latest dev (7.x-1.x-dev) version, it will already have the patch. 

Note: The rule of thumb, is to use the Stable version rather than the Dev version.