tags:

views:

56

answers:

1

We have to keep 2 product versions. Now, some changes in each version have to be backported to another version.

In SVN, if I made "change" to version 1, I merge this revision to version 2 and give comment like: "Merged 'change' from v1".

This is awkward in many ways. Even worse if I merge several changes.

Can git help me to have single change being promoted to both branches, so that revision comment, date, everything belong to one commit for both versions, after I "merge" 1v1 to be part of second branch?

A: 

As far as I know, Git doesn't allow a single commit to affect multiple branches.

But an interesting approach about Git is that it doesn't just applies patches from the branch to another when merging. When you merge commits from a branch to another, Git actually keeps commit messages between branches.

So when you use Git merge command, all commits informations are conserved : author of the commit, commit message, date, and even commit ID. So all the informations about the commit are preserved when merging.

Vivien Barousse
I don't ask about committing to several branches, but really about "keeps commit messages between branches". So git can do this? It keeps same commit ID, time, etc?
queen3
Yes, I think this is the default behaviour. I edited my response, I hope this is a better answer to your original question.
Vivien Barousse
OK so I accept the answer, I didn't ask for examples or a howto, just to confirm the idea ;-)
queen3
Further to the answer that you already have: in Git a commit is not a state of the tree, it is a delta between two trees. The same delta can be applied to different branches and so you can get the same commit in multiple branches. I use this on a regular basis to keep a linearised (SVN view) of a repository and a "real" underlying history at the same time.
Amoss