505 B
505 B
Example: Create a new repo from a subdirectory
Useful if you want to pull a directory, and its commit history, out into a new repo.
# Clone the repository into a new directory.
git clone _.git
# Get only the files and commits impacting a particular directory.
git filter-branch --prune-empty --subdirectory-filter <pathToDirectory> <branchName>
# View and then update your remotes with the new repo location.
git remove -v
git remote set-url origin _.git
git push -u origin <branchName>