I am soon going to be converting my part of an application from using an svn
backed repository to using git
one.
I've previously used git-svn
, but the whole team is being moved to git
and I've been asked to be in the vanguard of that move. Although I'm happy I understand how do do most of the move, there is one aspect that I've yet to work out.
One directory of my configuration repository has always been used to track the scripts directory of an external application on a standalone windows machine. The scripts directory for that application is inside the applications install directory, so with svn
I did a checkout of just that directory at the appropriate point.
I was hoping that I would be able to continue with that structure, but my research suggests that narrow clones in git
require you to keep the same relative structure, which would be difficult in my case.
To be explicit, I want to map the contents of myrepo:config/scripts
to C:\application\scripts
.
As far as I can see it, I have several options:
This would probably be preferred, as it allows me to clone the repo into exactly the right location.
Unfortunately there is currently no structure which allows configuration data (which is what these scripts are) to be stored anywhere other than under the configuration directory. As such, this would require some restructuring of our repositories beyond the straight conversion from svn
to git
that we were hoping for.
I could put the git
working copy of the config
directory elsewhere on C:\
and then use a junction point to make the directory appear as a sub-directory of the application directory, just as Ger4ish suggests using symlinks on unix.
Unfortunately I have no admin access to that machine, so this is not as simple as it first appears.
I wonder if there are options that I've missed.
Looking at the answers to the question Sparse checkout in Git 1.7.0? I can get some of the way, but the requirement to keep the structure the same combined with the need to check out into a specific position means that this method won't work.
Have you looked at submodules? You could make a separate git repository for your config scripts and add it as a submodule to your main repository. This would allow you to do the checkout directly in application/scripts
but still keep the config directory under the primary repository.
There are some nuances with how submodules relate to the primary repository so you would want anyone who is committing to the scripts directory to understand this workflow.