Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a new git repository from a folder in an existing git repository?

I want to create a new git repository of a folder under an existing git repository. I want the history to be preserved in the new repository. How do I create this new git repository?

like image 555
senthil Avatar asked Mar 24 '11 15:03

senthil


1 Answers

You can clone it, and then apply on the clone a filter-branch in order to split that repository, extracting only the directory you want (with its full history).

See Detach subdirectory into separate Git repository

Note the git clone --no-hardlinks /XYZ /ABC used during the cloning step:

The --no-hardlinks switch makes git use real file copies instead of hardlinking when cloning a local repository.

like image 148
VonC Avatar answered Sep 24 '22 06:09

VonC