1

I have a Git repository. In this repository is a directory called core_code, which contains common code used in several pieces of software (like a common library). There are also directories called program_alpha and program_beta, which contain two different pieces of software but are related. Both program_alpha and program_beta rely on core_code to function, and when the software is run, the core_code needs to be in the program directory. So when I'm running the software, both program_alpha and program_beta need to have copies of core_code within them (for reasons specific to the application, the core_code must be in the program root and cannot be referenced from somewhere else).

So, I'm looking for a way to have core_code available in all program_* directories, but without duplicating it. Initially I wanted to do something like have a symlink in each program_* directory that points to the core_code directory, but I'm using the code cross-platform and Git does not hand Windows symlinks well at all. I also must keep all this code in the same repository, so I can't have a separate repo for core_code and then use submodules in the program_* directories.

Any suggestions for the best way to do this? It would be so simple if symlinks worked better in Git.

Jordan
  • 3,998
  • 9
  • 45
  • 81

1 Answers1

0

You can use a post-checkout hook on Windows machines. Try this implementation on github. You can find more discussion on this method in another question: Git Symlinks in Windows

If your repo is meaned to be shared among a large group of users, it is better to copy the core_code with Makefile or configure script. Don't rely on git-symlink or hook.

Community
  • 1
  • 1
gdlmx
  • 6,479
  • 1
  • 21
  • 39