79711176

Date: 2025-07-23 00:33:47
Score: 0.5
Natty:
Report link

git filter-repo is a powerful tool to rewrite history and extract a subfolder.

  1. Install git filter-repo (if not installed):
pip install git-filter-repo
  1. Clone your repo into a new directory:
git clone <original-repo-url> subfolder_repo
cd subfolder_repo
  1. Run filter-repo to keep only the subfolder:
git filter-repo --subdirectory-filter subfolder_name
  1. Now your repository only contains the history and files of that subfolder.

  2. Add remote and push:

git remote add origin <new-repo-url>
git push -u origin main

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): is a
  • Low reputation (1):
Posted by: Arfat Hossain