0

I am trying Git, and so if i do

mkdir foo
cd foo
git clone git://github.com/some_repo/sdk.git

so my project folder will now have sdk, which is a library or an sdk. How to make sdk part of my project now? That is, just 1 repo instead of git init and have 2 separate repos?

nonopolarity
  • 146,324
  • 131
  • 460
  • 740
  • 1
    What you're describing is the exact use case for git submodules; similar to svn externals. I suggest using the library/sdk as a submodule. – Scott Oct 29 '10 at 06:11
  • you mean better separate and not as 1 repo? – nonopolarity Oct 29 '10 at 06:27
  • Your proj repo will reference the other one and use it as such. – Scott Oct 29 '10 at 06:59
  • @動靜能量 It depends if your project and sdk are the same project. If sdk is an independent software, than submodule is the way to go. If your project and sdk are the same software, it could be a benefit to include your project into the sources of sdk. When in doubt use submodules. – Rudi Oct 29 '10 at 09:45

1 Answers1

1

If project sdk:

  • is not developed at the same pace than your foo project (i.e. changing anything in foo doesn't always involve changing sdk, and changing sdk doesn't mean changing foo)
  • must have sdk as a sub-directory

, then, as Scott comments, a submodule approach is useful, because (as I describe in "true nature of submodules") you will be able to:

  • reference a specific version of sdk
  • while still being able to modify sdk directly from within your foo project.

Yes, they will be two separate repos, but you can still manage them from the parent repo foo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • One repo would mean " **subtree merging** " (http://stackoverflow.com/questions/908087/how-to-version-project-schedules-to-dos-wikis-etc-in-git/908892#908892), but you would loose any link between sdk and its original github repo. – VonC Oct 29 '10 at 07:02