sterpe / tricks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tricks

Git: Moving files from one Git Repository to Another, Preserving History

git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
mkdir <directory 1>
mv * <directory 1>
git add .
git commit
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

About