Skip to content

Instantly share code, notes, and snippets.

@tfedyanin
Created February 7, 2017 13:03
Show Gist options
  • Save tfedyanin/717b69dee6d5c9e70619bbd43d627c99 to your computer and use it in GitHub Desktop.
Save tfedyanin/717b69dee6d5c9e70619bbd43d627c99 to your computer and use it in GitHub Desktop.
git clone <git repository A url>
cd <git repository A directory>
git remote rm origin
git filter-branch --subdirectory-filter <directory 1> -- --all
git remote add origin <git repository B url>
git push --set-upstream origin master
git clone <git repository A url>
cd <git repository A directory>
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch <directory 1> -r' --prune-empty --tag-name-filter cat -- --all
git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment