Git equivalent of file externals in svn
Background: We have a common project which we partly reference from other projects.
- Jenkins - passing updated revision to downstream jobs
- include multiple folders using svndumpfilter
- How do I do an exclusive checkout in SVN?
- Netbeans and SVN UUID problem
- converting svn repo to git using reposurgeon
- Idea to mirror an svn to git
With git submodules – as far as I know – only repositories can be referenced – but not single sub-folders or files.
We basically need a distributed version control system that supports externals like svn.
It seems that git doesn’t provide what we need. Am I right? Please prove me wrong.
We have one quite big svn repository that contains several projects. Each child-project depends on the base project. But each child-project only needs certain files or folders from the base project – depending on the child-project. So we utilize file- and folder externals with and without revision number to resolve those dependencies.
The base project has the following structure:
BASE - libs -- dll1.dll - doc -- howto.doc - maps.csv - cols.csv - misc.ini - fun.png
A child-project references the base project using externals like that:
"Base/libs@27" inspect "Base/doc" doc "Base/calibration/map.csv@14" map/default.csv "Base/calibration/cols.csv@56" cols/default.csv
2 Solutions collect form web for “Git equivalent of file externals in svn”
An alternative to Git submodule is Git Subtrees which looks like what you are looking for.
More information at http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging
I’ve not found a clean solution for this, but there are a number of workarounds.
The cleanest seems to be to include Base in it’s entirety in a secondary location, using submodules, or subtree merge, and then use symlinks on the individual files to put there where you actually need to use them.
This doesn’t seem very clean, and in particular, including different versions of Base to satisfy your “with and without revision number” requirement could get very messy, but I’ve not seen a clean alternative yet.