git: Apply changes introduced by commit in one repo to another repo
You probably want to use git format-patch
and then git am
to apply that patch to your repository.
/path/to/1 $ git format-patch sha1^..sha1
/path/to/1 $ cd /path/to/2
/path/to/2 $ git am -3 /path/to/1/0001-…-….patch
Or, in one line:
/path/to/2 $ git --git-dir=/path/to/1/.git format-patch --stdout sha1^..sha1 | git am -3
You can do cherry-pick
if you add the second repo as a remote to the first (and then fetch
).