I followed this excellent answer to extract a subdirectory of my git repository into my own repository, while preserving the whole story.
My repository looks like this:
src/ http/ math/ tests/ http/ math/
I want to create a new branch that contains only the src/math and tests/math directories.
If I run the following command:
git subtree split -P src/math -b math
It creates a branch containing the contents of the src/math directory, but discards the src/math/ prefix.
If I try the same command with two directories:
git subtree split -P src/math -P tests/math -b math
It only extracts the contents of tests/math , ignoring src/math , and also discarding the tests/math prefix.
To summarize, I would like my last repository to look like this:
src/ math/ tests/ math/
That is, preserving the original directory structure, but discarding everything that is not explicitly specified on the command line.
How can i do this?
source share