Created
May 12, 2014 18:18
-
-
Save iangreenleaf/984bc6765d2a4dc49862 to your computer and use it in GitHub Desktop.
Import seperate git repo as subdirectory
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
export target=my_dir | |
git remote add "$target" file:////path/to/original/repo | |
git fetch "$target" | |
git co -b "$target" "$target/master" | |
# Probably breaks on whitespace, sorry dawg. | |
git filter-branch -f --tree-filter "mkdir -p \"$target\"; git ls-tree \$GIT_COMMIT --name-only | xargs --no-run-if-empty mv -t $target" "$target" | |
git co master | |
git merge "$target" | |
git remote remove "$target" | |
git br -d "$target" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment