2

Currently we are planning to switch from our software version 5.x.x to 6.x.x. Such major releases contains in our case a lot of refactoring work and changing the software architecture. Instead of creating a new branch for version 6 (git), I thought to create a custom repository for this. In general, developing the new version bases on the old version, so it would be a copy.

My problem is that developing version 5 will not stop, because bug fixes and a few minor changes will be done. But now I have two versions I am working on, in two separate repositories. What is the best way to make changes in both, without copy code, or do the work twice? Is there some effective way?

Maybe some one else has the same issue before.

gnat
  • 20,543
  • 29
  • 115
  • 306
BendEg
  • 149

2 Answers2

8

One common way to handle this scenario is to use a trunk/branch concept. What you do is have the single repository and branch the 5.x.x version for maintenance reasons. Then you put all of the your new 6.x.x changes into the trunk. That way you maintain all of the version history of your code. This also allows you to check out the old version and make a targeted fix there without impacting the trunk.

Here is what this would look like:

                                                |------branch (5.x.x)
                                                |
----------------------------------------------------------------------Trunk (6.x.x)

Then later if you ever need to have a version 7.x.x you could do the same again:

             |------branch (5.x.x)
             |                             |---branch (6.x.x)
             |                             |
---------------------------------------------------------Trunk (7.x.x)
barrem23
  • 3,171
2

Several solutions are together with git. I have get good experiences with git-worktree for such situations. Excerpt from the manual pages:

Manage multiple working trees attached to the same repository.

A git repository can support multiple working trees, allowing you 
to check out more than one branch at a time. With git worktree add
a new working tree is associated with the repository. This new working
tree is called a "linked working tree" as opposed to the "main working
tree" prepared by "git init" or "git clone". A repository has one main
working tree (if it’s not a bare repository) and zero or more linked
working trees.

A complete copy here: https://git-scm.com/docs/git-worktree

silvio
  • 121