There is a simple solution that does not require manual editing of patches and an external script.
In the first repository (this can also export a commit range, use -1 if you want to select only one commit):
git format-patch --relative <committish> --stdout > ~/patch
In the second repository:
git am --directory blue/red/ ~/patch
Instead of using --relative in git format-patch another solution is to use the -p<n> option in git am to remove n directories from the patch path, as indicated in answer to a similar question .
You can also run git format-patch --relative <committish> without --stdout , and it will generate a set of .patch files. These files can then be directly transferred to git am using git am --directory blue/red/ path/to/*.patch .
magiraud Apr 27 '15 at 6:36 2015-04-27 06:36
source share