How to manage multiple versions of a project? [closed]

And yet, branching should work, and will allow you to maintain two separate versions.

If you have a bug which applies to the premium version, fix it on master, and merge it on premium branch.
Git will only merge what has changed since you branched between master and premium, ie your bug fix.
On another way to publish an hotfix both in master and premium would be to do it from the common ancestor: see “Git merging hotfix to multiple branches”.


Update 2015: git 2.5 (July 2015) has replaced git-new-workdir presented below by the new command git worktree add <path> [<branch>].

For more, see “Multiple working directories with Git?“.


Original answer 2012:

me-and mentions in the comments the command git-new-workdir.
See:

One solution to this is to simply create another local clone of your repository. Git automatically uses hard links when you clone locally, so cloning is very fast.
But there is one problem with this: You now have another, separate repository you need to keep up to date.

This is where git-new-workdir comes in.
Instead of doing a full-blown clone of your repository, it simply sets up a new working directory (with its own index) for you.
The actual repository itself is shared between the original and the new working directory. This means:

  • If you update one repository, the new commits are instantly visible in all other working directories as well.
  • Create a new commit or branch in one of your working directories, they’re instantly available in all working directories.

Note: Even though the commits are automatically there, Git won’t update the working copy if you’ve got the same branch checked out. You’ll have to do that for yourself.

Leave a Comment