I have multiple projects in different repositories:
tools
thirdparty
shared
├──Common
├──Exceptions
multimedia
├──VolumeControl
├──VideoRenderer
android
├──Audio
For example, android depends on shared/Common, shared/Exceptions, tools, thirdparty and multimedia/VolumeControl.
I tried:
However, they both checkout or bring-in multimedia folder within the android folder. Instead, I want it like:
android
├──Audio
├──VolumeControl (brought in from multimedia)
How do I accomplish this?
Note: I used to accomplish this using lockexterns in svn.
How do I accomplish this?
You can use git filter-branch
and or git subtree split
filter-branch will loop over each commit and then you can checkout only the given files while git subteree split
will be a better option in your case.
Explaining both of the option so you can choose which one you prefer.
filter-branch
# Filter the master branch to your directory and remove empty commits
git filter-branch --prune-empty --subdirectory-filter YOUR_FOLDER_NAME filter_from_branch
This will checkout all your desired files from the given folder to the current directory
subtree split
git subtree
git-subtree
-Merge
subtrees together orsplit
repository into subtrees
git subtree split -P <name-of-folder> -b <name-of-new-branch>