Created
March 3, 2015 00:56
-
-
Save urecho/55c2e1e201c9964f6c36 to your computer and use it in GitHub Desktop.
Git: Copy a file or directory from another repository preserving the history
This file contains 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
src : 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