The git repository for an existing open source library looks something like this:
A/ B/ C/ D/ E.txt F.txt
I need to create a new repository for a new library, beginning with a copy of a subset of this code. For example, I might want my repository to contain:
A/ B/ E.txt
That is, I want the new repo to contain the
B directories (with their contents) and
E.txt unchanged. The new library has no need for
I can see two ways to do this:
git clonethe existing repository, then
git inita new repository, then
git addthe latest versions of
The problem with the first approach is that there will be significant history in the repository for the items which have been removed. This history is irrelevant for the new library. OTOH, the second approach leads to a repository with no history at all!
Which of these approaches is preferable?
Might it be better to create my new repository that contains only the relevant files and only the history for those files? Can this be done (perhaps with
git filter-branch)? Would this indeed be better than either of the above approaches?