I want to extract a directory from a repository, including all its commit history. The problem I'm having is that the end result, does not contain commit history prior to moving/renaming the files (which was done at some point).
Example:
I want to extract src/lib/features/TheLib from a project repository.
This directory 'theLib' used to be in a different location at some point, e.g. 'src/util/lib/TheLib'.
The main repository contains full history of changes made to the files, including changes before the lib was moved to a new location within the repo.
If I try to extract the directory into a new repository, I only have the commit history from the point after the files were moved/renamed.
I have tried this [0]:
$ git filter-branch --prune-empty --subdirectory-filter src/lib/features/TheLib master
and this [1]:
$ ./git-filter-repo --subdirectory-filter src/lib/features/TheLib
Both tools give me the same results. It almost works fine, except no commit history prior to renaming.