2

I apologize in advance for the lack of clarity in both title and body, but I'm not even sure how to phrase this question in simple "search-string" format.

Basically, I want to know if it is possible to use a git repository, or a file inside a git repository, as a resource in a project located in another repository. This question arised to me when I started using several repositories with symlinks to files between them.

A simple example is, I have a few repositories that I use for holding latex projects, each of which is being carried out with different people (meaning I can't just use one repo for everything), but all sharing the same .bib. At first I held the .bib in a single local folder and used symlinks in each repo, but this meant my colleagues were unable to compile the projects as the .bib file itself was not available in any of them. I then proceeded to make hard links between them, essentially mirroring the modifications in several instances of the .bib file, but this meant I had to push to several different repos after making modifications in a single one of them (the .bib update has to be available to all repos).

Out of this situation arised the idea of having a repo specifically for the .bib file, and then somehow having other repos automatically pull that file along with their own stuff. I could just pull from two different repos each time, but it'd certainly be handy to have the dependency solved automatically.

This problem generalizes to other situations, such as a library that is shared between different projects, or bigger projects that split into different repos but would benefit from centralized project management.

I apologize again for the lack of clarity, and will try to answer any inquiries to the best of my ability to see if I can find a solution to this. A "symlink" to a git repository would make much of my work a lot easier, as I work with different teams and share much of my own resources between them.

As an addendum, I AM using github to hold these gits. I'm not certain if that makes a difference, but figured I'd mention it.

  • 2
    Git's answer to this is the "submodule". However, submodules have their own drawbacks. In the old days many people called them "sob-modules" because of these. They're better now than they were in the Git 1.5 to 1.7 days, but I still distrust them myself. :-) – torek May 22 '17 at 07:03
  • see http://stackoverflow.com/questions/7328449/add-symlinks-to-git-repository – Gerard Rozsavolgyi May 22 '17 at 07:03
  • I had not heard of submodules, this seems like a good choice for managing these kinds of peoblems. Thank you for the responses, I will take some time tomorrow to see if I can make it work, and if not, to return here and analyse why. I am heading to sleep now though so good night, and any and all suggestions are helpful! – Fledgling Pidgeon May 22 '17 at 07:12
  • Please check this https://stackoverflow.com/questions/15844542/git-symlink-reference-to-a-file-in-an-external-repository/27770463#27770463. This may help you to solve your problem. – Nija I Pillai Feb 16 '21 at 13:02

0 Answers0