Created
March 22, 2019 13:46
-
-
Save imagejan/1479b866ff97e37419aa212a10516f01 to your computer and use it in GitHub Desktop.
Copy files or directories from another git 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
# see http://blog.neutrino.es/2012/git-copy-a-file-or-directory-from-another-repository-preserving-history/ | |
mkdir /tmp/mergepatchs | |
cd ~/repo/org | |
export reposrc="path/to/file1 path/to/file2" | |
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