Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Happens to Commit Logs on a Branch After Merging?

Tags:

branch

merge

svn

Scenario:

  1. Programmer creates a branch for project 'foo' called 'my_foo' at revision 5
  2. Programmer makes multiple changes to multiple files as he works on the 'my_foo' feature.
  3. At the end of each major step, say adding several new functions to a class, the programmer does an svn commit on the appropriate files therefore committing them to the branch
  4. After several weeks and many commits later (each commit having a commit log describing what he did), the programmer merges the branch back into the trunk:
  #Assume the following is being done from inside a working copy of the trunk: svn merge -r 5:15 file:///path/to/repo/branches/my_foo  

Hazzah! he's merged all his changes back into trunk! There's much rejoicing and drinking of Mountain Dew.

Now let's say another programmer comes along a week later and updates their working copy from revision 5 to revision 15. "Wow", they say. "I wonder what's changed since revision 5". The programmer then does an svn status on their working copy and they get something like this:

 ------------------------------------------------------------------------ r15 | programmer1 | 2010-03-20 21:27:04 -0400 (Sat, 20 Mar 2010) | 1 line  Merging Version 2.0 Changes into trunk ------------------------------------------------------------------------ r5 | programmer2 | 2010-02-15 10:59:55 -0500 (Mon, 15 Feb 2010) | 1 line  Added assets/images/tumblr_icon.png to trunk 

What the heck happened to all the notes that the other programmer put in with all of his commits in his branch? Do those not get pulled over during a merge? Am I crazy or just forgetting something?

like image 891
Levi Hackwith Avatar asked Mar 26 '10 00:03

Levi Hackwith


People also ask

What happens to commits after merge?

So, instead of merging you first execute the following while on branch-b, git rebase master . This creates new commits that are copies of the old commits, i.e., the same change-set, author information and message, but new committer information and parent history.

What happens when branches are merged?

When you perform a merge, you effectively merge one branch into another—typically a feature branch or bug fix branch into a main branch such as master or develop. Not only will the code changes get merged in, but also all the commits that went into the feature branch.

What happens to a branch of a branch after merge?

In a good workflow, the feature branch is deleted once its merged back into master. New branches should be created for each new feature(s) that you work on. If you're not super creative with coming up with branch names and/or want to reuse the same branch name, that is ok.

Can you commit to a merged branch?

Merges a branch into the current branch, creating a merge commit. Use git checkout <target-branch> to switch to the branch into which you want to merge. Use git merge --no-ff -m <message> <source-branch> to merge a branch into the current branch, creating a merge commit with the specified <message> .


1 Answers

Try svn log -g to include merge history that is stored since Subversion 1.5.

like image 153
Ted Percival Avatar answered Sep 23 '22 04:09

Ted Percival