Search code examples
gitgithubversion-controlrepositorygithub-pages

Is symbolic link between two git repositories possible?


I have gone through some documents regarding this topic and I was really confused with git submodules and how can it achieve symbolic link.

Below is my scenario which I have to achieve: I have two GitHub repositories repoA and repoB. I have to link some files from repoA into repoB, so that whenever a change is made on those files in repoA, it should reflect on repoB also.

My first question is - Is this possible in GitHub? If possible, how can we achieve this?

Most of the documents I have gone through are at least 5 years back. I know this is an old question, but I just want to know if anything is possible now to achieve this task.


Solution

  • I have gone through some documents regarding this topic and I was really confused when most of the docs concluded in creation of submodules when asking about symbolic link.

    And the docs are right. The scenario you want to achieve is possible via submodules and one more method. GitHub does not provide with any functionality in itself to implement what you want to do.

    To do this with submodules, all you need to do is add the submodule and work with it. update the submodule from time-to-time to keep track of the changes on the submodule's upstream and sync those changes with your working tree's master.

    I understand that submodules may be a bit intimidating at first but they are a great tool to use! The other solution can be to clone the desired repo into your working tree and keep pulling changed from its upstream when required. That won't create a symlink b/w the working tree and the new repo though.

    Best