I have a Git repository with multiple branches. I'm looking to take certain folders from one of the branches and create a n开发者_如何学Goew repository with just those folders. What's the best way to do this while keeping my history for those folders intact?
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
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.
精彩评论