Last active
July 26, 2016 14:09
-
-
Save cvakiitho/7167ff3098d7f28e90c2e79d653eda6f to your computer and use it in GitHub Desktop.
Git extract directory 1 from repo A to repo B - including history only from that dir
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
git clone <git repository A url> | |
cd <git repository A directory> | |
git remote rm origin | |
git filter-branch --subdirectory-filter <directory 1> -- --all | |
// now you can move it to another dir if you need to - so it is in same structure as repo B | |
git clone <git repository B url> | |
cd <git repository B directory> | |
git remote add repo-A-branch <git repository A directory> | |
git pull repo-A-branch master | |
git remote rm repo-A-branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/