1

So I want to have a project set up like this:

-- Project
   -- .git
   -- SubProject (Used by project)
      -- .git

The idea is that on github Project is a repo and SubProject is another repo. if I set up a project like this, does this mean that Project - on github - will show a "refrence" symbol to SubProject repo?

Also - if this is the case, when Person B pulls Project down to work on it will it also pull the reference project inside - SubProject ?? Or will they have to then pull that project?

right now I have the projects separate on git hub - which is how I want them, they are two projects - how ever Project uses SubProject and I feel that when I develop SubProject I am always developing it inside of Project then copying over to SubProject and committing - theirs no history their. I want to develop SubProject inside of project so that subproject gets some history.

How will this work for pushing, pulling, merging, branching and at the end of the day tagging and zipping up to then distribute? - Project would be the one tagged and distributed -

Scott Berrevoets
  • 16,921
  • 6
  • 59
  • 80
LogicLooking
  • 916
  • 1
  • 16
  • 32

1 Answers1

0

You can use, as mentioned, submodules.

As I explain in "True nature of submodules", it is a good way to keep a fix reference to another repo (SubProject) from a "parent repo" (Project).

Both repo have their history independent and separate:

  • making a branch in one won't make a branch in the other.
  • make a tag in the parent repo won't tag the submodule repo (but it will include the SHA1 of that submodule at the time of the tag, guaranteeing that pulling the parent repo from that tag will restore the right version of the submodule).

Note that, from git 1.8.2+, you can configure your submodule to track a branch of its own.
Or you can convert an existing submodule to track a branch.
And you can remove a submodule at any time.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250