I have my Git repository which, at the root, has two sub directories:
When this was in SVN,
/finisht was checked out in one place, while
/static was checked out elsewhere, like so:
svn co svn+ssh://[email protected]/home/admin/repos/finisht/static static
Is there a way to do this with Git?
EDIT: As of Git 2.19, this is finally possible, as can be seen in this answer.
Consider upvoting that answer.
Note: in Git 2.19, only client-side support is implemented, server-side support is still missing, so it only works when cloning local repositories. Also note that large Git hosters, e.g. GitHub, don’t actually use the Git server, they use their own implementation, so even if support shows up in the Git server, it does not automatically mean that it works on Git hosters. (OTOH, since they don’t use the Git server, they could implement it faster in their own implementations before it shows up in Git server.)
No, that’s not possible in Git.
Implementing something like this in Git would be a substantial effort and it would mean that the integrity of the clientside repository could no longer be guaranteed. If you are interested, search for discussions on “sparse clone” and “sparse fetch” on the git mailinglist.
In general, the consensus in the Git community is that if you have several directories that are always checked out independently, then these are really two different projects and should live in two different repositories. You can glue them back together using Git Submodules.
Answered By – Jörg W Mittag
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0