Git – Managing multiple versions of a web application using Git

git

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.

Thanks!

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

Best Answer

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.

Related Topic