2

I am wondering what is the best way to organize git repository. I am building a web service that I will call Core, and an iPhone application that communicates with core.

I want to store my repositories on github, what is the best way to organize this ?

Should I create two repositories :

- projectname-core - projectname-iphone 

Or should I have only one repository with 2 different branches iPhone and Core ?

Cheers

4 Answers 4

4

It depends a lot on how intertwined the projects are. If the iPhone app is barely related to the code in the core, and changes in the core won't effect the iPhone app much, then use two separate repositories. The general rule is that git shouldn't be used to manage unrelated files in the same repository.

Sign up to request clarification or add additional context in comments.

1 Comment

I vote against the 2 repos as relating them will be complex via submodules or subtree - yet you need to version what works with what version. This is very true at the beginning when there is more flux in both projects. With git you can refactor later making it easy to start with.
2

You should have one repository with 2 directories. This will keep changes to both synced with one another. Should you need, you can split it up later to 2 repositories with the core as a submodule of the other using `filter-branch'.

5 Comments

This is a terrible idea. If they don't share code they don't need to be together. Repositories a cheap (resource wise)
This is not an argument on whether git repos are expensive resource-wise - please don't introduce a straw-man argument falacy. They depend on one another in terms of what works with what version-wise. NOT linking them is a horrible idea. Linking them via separate repos and submodules is not trivial. This is a workable starting point where both projects are in a lot of flux.
Straw man? I don't believe I raised one to knock down. Keeping two code bases in one repository that don't share common code is a bad idea. The history of changes will be a mix of commits of each project. Using two separate repos with a submodule of common code (if any) may not be trivial, but it is easy. And, if you think you might want to separate code in the future it's better. IMHO to just use two repos from the outset.
You raised the straw man by making it seem that my issues were with resources. Read the thread again. Cont: It is not easy. Especially when you get more than one dev on it. I would appreciate you erasing the down vote. I bring up an important point in the issues that submodules bring. Rebase in the submodule, try and git bisect on the containing repo... the list goes on and on. The submodule tax is too heavy of a burden in a lot of scenarios. Subtree looks promising but is missing the syntax and tooling right now to make it viable. Git slave is also good but supports only the "happy path".
1) My reasoning is that unless the projects share code, they don't need to be together. Saying that repos are cheap is a different statement. This is about a web service and an iPhone app. How much shared code do you think there's going to be? 2) Submodule tax? You brought up submodules, not me. I'm saying putting everything into one repository is a bad idea. 3) And no, I'm not going to reverse my downvote. I still think your answer is a bad one. If others think your answer is a good one they are free to upvote
1
  • either 2 directories in one project (if you project is small witch is often the case with IPhone apps)
  • or with submodule in which case you will have 3 repositories: core and iphone along with a master (or another name) witch keep the sync between the 2 submodules (git submodule tutorial)

Comments

1

Branches are normally used to create a branch of the project, not to create sub projects.

If your server and iPhone have completely different code base, which is likely the case, then create two repositories. To tie the iphone client to a specific version of core, use git submodules to reference the core. The reference is useful for testing.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.