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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With