I work on WordPress based project and I want to patch my project at each new release version of WP. For this, I want generate a patch between two commits or tags.
For example, in my repo /www/WP
I do this :
$git patch-format com1..com2 --stdout > ~/patchs/mypatch.patch
Or
$git patch-format tag1..tag2 --stdout > ~/patchs/mypatch.patch
/www/WP
git natif WordPress
/www/myproject
My git project WordPress based
The git apply
command line doesn't work, I think because we are in different repositories.
Can I generate a patch file without a commit, just a differential and apply it to another git repository ?
Thanks advance.
To produce patch for several commits, you should use
format-patch
git command, e.g.This will export your commits into patch file in mailbox format.
To generate patch for the last commit, run:
Then in another repository apply the patch by
am
git command, e.g.See:
man git-format-patch
andgit-am
.You can just use
git diff
to produce a unified diff suitable forgit apply
:You can then apply the resulting patch with: