1

I'm using github as a repo for a little project, but I'd also like to use some code written by another github user.

Is it possible to setup a /library/libraryname folder inside my project which maintains it's links back to the other users repo as well as being part of my projects commits?

For example: If the other user updates their code later on, I'd like to be able to easily fetch their changes while still keeping it in the same repo as my main project.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Tom
  • 33,626
  • 31
  • 85
  • 109

4 Answers4

3

I think you're probably looking for the git submodule command. Also have a look at the Git Submodule Tutorial.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Yep I think I do want submodules, Thanks for the link to the Tutorial. – Tom Aug 17 '09 at 11:03
  • It looks like submodules only represent a specific commit number of another repo, and they require a submodule push before pushing the super project to show all changes. Can anyone confirm these limitations? – Chris Aug 17 '09 at 16:57
1

If you want, you can use git subtree instead of git submodule. This is a little bit more convenient to use, and doesn't require people who checkout from your repository to know anything about submodules or subtrees. It also makes it easier to maintain your own patches to the subproject until you're ready to submit them upstream.

apenwarr
  • 10,838
  • 6
  • 47
  • 58
-1

-- edit

Removed my claim that it's 'probably not possible'. Rest of my argument is still valid.

But anyway, generally, you don't want to get updates so fast like that. You'd prefer to have a 'stable' version of his library, and update it only when another 'stable' version is released (as tested by you; not neccessarily one considered 'stable' by him).

So even if you could (but in SVN, which I use, you can't, but I don't know about git specifically) you wouldn't want to.

Noon Silk
  • 54,084
  • 6
  • 88
  • 105
  • It can be easily achieved with so-called externals – iElectric Aug 17 '09 at 10:58
  • Yea obviously I wouldn't want to update the external library all the time, but I wondered if there was a better way than just downloading a .zip of the changes and putting it into my repo. – Tom Aug 17 '09 at 11:01
  • iElectric - Didn't know that. Thanks.Tom my point is that even if you could, it's good practice not to do it. – Noon Silk Aug 17 '09 at 11:02