views:

21

answers:

1

I've got a project in a git repository that uses some custom (and so far unversioned) setup scripts for the build environment etc. I'd like to put these under version control (hopefully git) but keep them versioned separate from the project itself, while still living in the base directory of the project - I've considered options like local branches but these seem to have the problem that switch back to master (or any other "real" branch) will throw away the working copies of the setup scripts.

I'm on Windows using msysgit so I've got a few tools to play with; does anyone have a recommendation or solution?

A: 

If you really need them separate from your main git repo while still living directly within it, you could try:

  • creating a new repo with those script within it

and:

  • adding that new repo as a submodule to your repo. Except:
    • a/ those scripts won't live directly in the base directory, but in a subfolder representing the submodule
    • b/ you need of course to not publish (push) that new repo, in order for other cloning your main repo to not get those setup files

or:

  • merging that new repo into your main repo (with the subtree project), but:
    • you need to split back your project to get rid of those files
    • for a project with a large history, and with frequent push, that step (the split) can be long and cumbersome.

I would consider a simpler solution, involving some evolution to your current setup files:

  • a private repo (as in "not pushed") with those setup files
  • environment variables with the path of your main git repo in order for your setup files (which would not be directly within the base directory of said main repo) to do their job in the right directory (like beginning for instance with a 'cd right_main_git_repo_dir').
VonC
I think the simple solution might be the best here; I've created a private repos as a sibling of my project so any `cd ../project/` will work across both. Seems to be working so far; thanks!
Alphax