开发者

Move code between Git Repositories

开发者 https://www.devze.com 2023-04-11 12:13 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号