Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub include from another repository

Tags:

git

github

I'm new to github.

I have a github repo on my machine. I want to include another repo (as a third party) into my repo. I believe I should make a fork first. But how do I include it on my local repo?

I've tried submodules but with no success...

Thanks.

like image 907
ramaralo Avatar asked Jul 21 '13 19:07

ramaralo


People also ask

How do I reference another repository?

You can reference issues between repositories by mentioning user/repository#number in an issue. Once we see something like that — say, github/enterprise#59 — we'll make sure to update issue #59 in github's enterprise repository and let you know where it was referenced from.

Can a Git repository contain another Git repository?

Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.


1 Answers

git submodule remains the recommended way: you can declare (git submodule add) a repo which doesn't belong to you, or a fork (which, by definition, belongs to you).

Don't forget though, that:

  • you still need to git submodule update --init in order to see that submodule repo being displayed with its full content in your repo
  • add and commit the special entry representing the root directory of that submodule in your main (parent) repo, and push that commit, in order to validate that declaration.
like image 56
VonC Avatar answered Nov 03 '22 07:11

VonC