I have a git project that I used for a recently published scientific paper. In the project I have subdirectories doc
(split into doc/paper
doc/talks
) results
src
and more.
Now I would like to release my source code (but not my presentation slides, etc.). What is the best way to give people access to just the src
subdirectory? I would release a zip file taking a snapshot of the current src directory, but I want people to get updates easily.
Thanks a lot. Oliver
Short version:
You need to use a separate repo per top-level folder you want to give access to. See submodules for more info on how to go about doing that.
"sparse" checkouts could work, but I believe this cannot be forced upon your users, who has to clone the entire repository to local anyway, then just get a partial working directory.
(You could also setup a separate repo that would be auto-updated and push changes to that, but you lose the opportunity to merge forks and fixes from your userbase, which is sort of the point, I guess.)
Longer version: Wo The "new" distributed version control systems (Git, Mercurial, Bazaar, etc) are not built around per-folder checkout in the same fashion as SVN and CVS. Having the branching tree separate from the directory tree simplifies handling branches and merges in the revision graph, as these are more numerous than for centralized VC:es. (SVN, IMO, handle branches & merges like a sledgehammer handles opening a can of spam, much of this is due to the fact that any directory in the hierarchy can be branched/merged).
The partial checkouts feature is easy to give in centralized scenarios where you don't branch/merge, and was therefore popular in the dawn of time. You don't get that anymore, and will probably learn to be thankful for not having it. :)
Having a few subrepos/submodules of the important stuff is therefore easier. Branching the top repo is slightly more complicated though, so you need to think about how you want to set things up to make things easy for you to work with. (Maybe releasing the presentation slides is not that bad? :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With