2

I have a Git repository with multiple branches. I'm looking to take certain folders from one of the branches and create a new repository with just those folders. What's the best way to do this while keeping my history for those folders intact?

Manish Burman
  • 3,069
  • 2
  • 30
  • 35

2 Answers2

3

For certain definition of 'intact', you can create a history of commits which only contains a given folder by using git filter-branch with the --subdirectory-filter option.

See this previous SO question: Detach (move) subdirectory into separate Git repository

Community
  • 1
  • 1
Amber
  • 507,862
  • 82
  • 626
  • 550
0

Best and easiest way I can think of is to clone the existing repository and just delete all the folders you don't want to keep in the new repo.

BenBtg
  • 836
  • 1
  • 9
  • 22