-1

Let's take the following example:

// GitHub repository owned by me

git@github.com:me/my-repository.git
-- folder1
---- file1.1.txt
-- file1.txt
-- file2.txt


// Some other GitHub repository
git@github.com:other-owner/external-repository.git
-- some_file.txt
-- file_want_to_use.txt

So, I would like to use file_want_to_use.txt into my-repository, having always the latest updates from his owner. Is it possible to do this and if so which is the best way of doing it?

So my-repository should look like this in the end

// GitHub repository owned by me

git@github.com:me/my-repository.git
-- folder1
---- file1.1.txt
-- file1.txt
-- file2.txt
-- file_want_to_use.txt // reflects always what is on master in git@github.com:other-owner/external-repository.git

ltdev
  • 3,461
  • 17
  • 60
  • 117
  • git submodules may be a solution – demonplus May 15 '22 at 11:09
  • 1
    If you only want that one file, you just need git pull from git@github.com:other-owner/external-repository.git and update it periodically. After that add/update it into your own repository. and push. – SeanH May 15 '22 at 11:09
  • Note that Git isn't really about *files*, it's about *commits* (which then contain files, but you get all the files that are in that commit, and not any other files). Submodules are klunky, but sometimes they're the right answer here. – torek May 15 '22 at 15:50

0 Answers0