3

I've been using this folder structure where I would have one main .git folder and then have subfolders inside which doesn't have .git folder.

So as example :

Main Folder
   Subfolder
   Subfolder
   Subfolder

Now what I want to do is, I would like to extract some of those subfolders and make them separate repositories with their histories. Which means subfolders will become a main folder as a repository. Any idea how?

em_code
  • 379
  • 5
  • 17

1 Answers1

0

The official documentation use git filter-branch.

But that or BFG are obsolete.

Use the new tool git filter-repo (directly in your regular local repository, although a backup is always a good idea before those kind of filtering)

Use a path shorcut:

git filter-repo --subdirectory-filter Subfolder1

Only look at history that touches the given subdirectory and treat that directory as the project root.
Equivalent to using --path / --path-rename /:

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250