0

I have a git repo locally. I want to use some files from other remote repos but I don't want to manually copy the files on to my repo locally or check it into my own repo. Is there any way I can just clone those files but they'll still be managed by the other repos and I can call git pull to pull any updates to only those files?

The idea is similar to a package manager but instead of with packages it's with git repo files. If I can't do this with files, what's the solution to manage dependent github repos.

Thanks,

sonoluminescence
  • 1,002
  • 1
  • 11
  • 28

1 Answers1

1

Git has a concept of submodules which might suit you:

It often happens that while working on one project, you need to use another project from within it. Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects.

Git addresses this issue using submodules. Submodules allow you to keep a Git repository as a subdirectory of another Git repository.

AFAIK it is not possible to add a single file from other repository - you'll have to checkout the whole repo. Here're similar questions on checking out a single file:

Community
  • 1
  • 1
bedrin
  • 4,458
  • 32
  • 53
  • as a rule of the thumb avoid submodules like the plague. Is there anything stopping you from just checking out the remote repos locally? – Mircea Jul 08 '15 at 20:33