Mike Flynn
Mike Flynn

Reputation: 24325

iOS multiple projects and git branches

Im not an expert at git, but I have a iOS project that has code that I would like to reuse. I will be switching out images and a little data to make each application different. I know you can do this with the targets approach but I wanted to keep everything seperate and out of the original xcode project. So my question is, do I create a branch for each new project, and if so what is the correct terminology or command to grab bug updates from the original code base into my new branch from the main branch? The new branch will never commit back to the master branch also.

Upvotes: 0

Views: 105

Answers (2)

Igor
Igor

Reputation: 1332

I strongly suggest you make different repository for each project, not different branch. If you have one repository for several projects and for each project different branch, very soon you'll have a mess in your repo.

Also, if you fix a bug on part of code which you want to reuse, you'll need to merge the fix with all branches which use that code.

So, I think the better and much cleaner approach would be to create different repositories for each project, and code which you want to reuse you can add as a git submodule.

So, you'll have repository for your iPhone project then submodule for your shared library, Restkit, and so on...

Upvotes: 2

Tommie C.
Tommie C.

Reputation: 13181

You will want to review the git branching section of the online reference at GIT-SCM. At a high level you will want to look at merging the various branches. Xcode 5/5.0.1 helps you immensely by using the menu Source Control > Working Copy > Project Name > New, Switch, or Select Merge Into/From Options...

Merge Options

Upvotes: 0

Related Questions