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
# Clone a fresh copy of origin repo and enter into it | |
git clone <giturl-repoA> | |
cd <repoA> | |
# Optional, to avoid pushing to the wrong remote repository | |
git remote rm origin | |
# From the repo source, remove all the files and history ourside the folder | |
git filter-branch --subdirectory-filter <folder-name> -- --all | |
# Optional, move all the files previously in the folder to a new one, as they are in the repo root now, and commit them (no push) | |
mkdir <directory-new-name> | |
mv * <directory-new-name> |