Want to break up your large GitHub monorepo into smaller, manageable repositories without losing commit history? In this video, I'll walk you through the exact steps to split a GitHub repository into multiple standalone repos using Git commands. Perfect for organizing microservices, libraries, or components!
🔧 What You’ll Learn:
How to extract a subfolder with full commit history
How to create a new Git repository from that subfolder
How to push the new repo to GitHub
Best practices for maintaining clean project boundaries
✅ No third-party tools required — just pure Git!
💬 Drop your questions in the comments and don’t forget to subscribe for more Git tutorials.
#github #split
Commands : https://bit.ly/3BjaqWK
```
pip install git-filter-repo
```
Move all the files with same folder structure:
```
git filter-repo --path aaa/ddd --force
git ls-tree -r HEAD --name-only
git remote add splited-new-repo-local-name https://github.com/Infinite-demo/Spli...
git push splited-new-repo-local-name main
```
Move all the files to new folder(test):
```
git filter-repo --path aaa/ddd --force --path-rename aaa/ddd:test
git ls-tree -r HEAD --name-only
git remote add splited-new-repo-local-name https://github.com/Infinite-demo/Spli...
git push splited-new-repo-local-name main
```
Move all the files to Root:
```
git filter-repo --subdirectory-filter aaa/ddd/ --force
git ls-tree -r HEAD --name-only
git remote add splited-new-repo-local-name https://github.com/Infinite-demo/Spli...
git push splited-new-repo-local-name main
```