We have a family of apps, all having the same base. Until now I've been developing this base, and the Git workflow was very simple:

  • Development is done in develop branch
  • New features are developed in name-of-the-feature branch
  • Releases are made in release-** branch

Until now, the code was the same for every app of the family. Let's say the base they share is now complete, and from now on the code will be different for every app.

I'm not sure how should I deal with git and this multiple apps that have the same base.

  • Should each one of them have its own git project?
  • Should they be on the same project, but each one in its own branch?

The point is: if I put them on separate projects, every modification done in the base of the app will have to me repeated in each of the apps. I'm not very familiar with git, but if I store each project in a branch, will be possible to merge the base modification with each app?

Does anyone have experienced a situation like this? I'm not sure how to proceed.


EDITED When I said version I didn't mean like version numbers. They are actually different apps that share the same base.

2 Answers 2


Leave the base app in it's own repository, and create new projects that depend on the jar you compile from that repository.

Git branches are not for multiple apps. Git prefers that you use one repository for each project or a related family of projects. Branches are there so that you can develop features in isolation, not so you can create entirely new project without leaving the repository.

You don't want to have multiple apps that share code - that's a maintenance nightmare. If as you suggest you develop each as a branch in your central repo, you will have a lot of merging going on to propagate the changes to each app. It's much easier to depend on a single, separate library and use something like Apache Maven to pull in project dependencies.

  • Much of the code that is shared is GWT code (views, services, etc). Is it possible to extract it to a jar library? Or it's just possible to server-side java code? Feb 13, 2012 at 12:58
  • View elements can be extracted, but possibly not to a jar. For instance, javascript can be extracted from every page into a single file that can then be included in each project. JSP common code should be extracted into JSP tags. You probably don't need to pull entire pages, but I don't know your project, so I could be wrong.
    – Michael K
    Feb 13, 2012 at 13:21
  • what do you think of this approach: stackoverflow.com/a/2540471/2615737 ? it seams reasonable... Jan 21, 2015 at 3:04
  • I don't think it's the same use case. That answer deals with two versions of the same app that are very slightly different, while this question is about what I see as different applications entirely. I'd still prefer not to have the branch at all even in the "slightly different" case; however, it's difficult to factor out functionality to separate libraries in Android if there is any view xmls involved. Looks like that answerer didn't think it was worth the trouble for his situation.
    – Michael K
    Jan 21, 2015 at 3:18

If the apps won't modify the base itself, consider leaving the base in its own repository. Then create a new repository for each of the individual apps and add the base as a git submodule.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.