Created
May 24, 2017 13:42
-
-
Save tuliren/fa12ec139f8e63867f2e96f9a2ca2cd4 to your computer and use it in GitHub Desktop.
Transfer files between two repositories with history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://blog.neutrino.es/2012/git-copy-a-file-or-directory-from-another-repository-preserving-history/ | |
mkdir /tmp/mergepatchs | |
cd ~/repo/org | |
export reposrc=myfile.c #or mydir | |
git format-patch -o /tmp/mergepatchs $(git log $reposrc|grep ^commit|tail -1|awk '{print $2}')^..HEAD $reposrc | |
cd ~/repo/dest | |
git am /tmp/mergepatchs/*.patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment