Re: [DRAFT] Branching and merging with git

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux@...>
Cc: <git@...>
Date: Wednesday, November 22, 2006 - 7:51 am

Junio C Hamano <junkio@cox.net> writes:


I actually remembered a better one.

        Subject: Necessity of "evil" merge and topic branches
        Date: Wed, 17 May 2006 23:25:55 -0700
        Message-ID: <7vy7wz6e8c.fsf@assigned-by-dhcp.cox.net>

This talks about a real-world evil merge and the reason why it
was necessary, and speculates a possible way to make life
easier.  I actually later used the "third branch to remember the
evil merge between two topics" technique I talked about in the
message to merge in another pair of topics, and it turned out
that it worked rather well.

There were two logically independent topics:

 - lt/setup.  Two commits, changing the calling convention of
   setup_git_directory() function -- the final tip of the topic
   was at a633fca0.

 - js/mv.  Three commits, making git-mv a built-in after
   refactoring some code from other parts of the system -- the
   final tip of the topic was at ac64a722).

They were not "obviously correct" when they started, so a topic
branch was used for each.  They had textually and semantically
some conflicts, and if they were to progress at different paces,
there was a need for an evil merge when the later one is merged
to master.

So I created another branch to merge the two topics together and
resolved their conflicts while my reading of their code were
still fresh.

	git checkout -b __/setup-n-mv js/mv
        git pull . lt/setup
	git checkout next
        git pull . __/setup-n-mv

Later js/mv became ready to be merged first.  So I merged it to
'master'.

	git checkout master
        git pull . js/mv

I was planning to cook lt/setup a bit longer but eventually
decided to merge it to 'master' as well after a short while.

	git checkout master
        git pull . __/setup-n-mv

I could have pulled lt/setup into master but then I would have
had to resolve the conflict between the two branches.  Since I
recorded the resolution earlier by making the merge, and pulled
that branch (which contained all of lt/setup already) into
'master', I did not have to remember what I need to adjust when
I did so.  If lt/setup had further updates on its own after the
"third branch __/setup-n-mv" was made, I would have then pulled
the tip of lt/setup into 'master' to complete the merge, and
that would have also resulted in non-conflicting simple merge.

This would have worked equally well if lt/setup were to graduate
first.

This might look too complex at the first look, but I thought it
might be an interesting topic in the "hints for managing your
topic branches" section.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [DRAFT] Branching and merging with git, Theodore Tso, (Wed Jan 3, 1:04 pm)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Sun Jan 7, 7:44 pm)
Re: [DRAFT] Branching and merging with git, Theodore Tso, (Sun Jan 7, 8:40 pm)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Sun Jan 7, 8:46 pm)
Re: [DRAFT] Branching and merging with git, Guilhem Bonnefille, (Mon Jan 8, 8:38 am)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Tue Jan 9, 12:17 am)
Re: [DRAFT] Branching and merging with git , Horst H. von Brand, (Sun Jan 7, 9:46 pm)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Sun Jan 7, 10:22 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Sun Jan 7, 8:24 pm)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Sun Jan 7, 10:35 pm)
Re: [DRAFT] Branching and merging with git, Theodore Tso, (Mon Jan 8, 10:03 am)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Mon Jan 8, 10:41 pm)
Re: [DRAFT] Branching and merging with git, Andreas Ericsson, (Tue Jan 9, 4:46 am)
Re: [DRAFT] Branching and merging with git, Theodore Tso, (Tue Jan 9, 12:58 pm)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Wed Jan 10, 12:15 am)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Tue Jan 9, 11:49 am)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Wed Jan 3, 1:08 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Thu Jan 4, 2:11 am)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Fri Nov 17, 1:44 pm)
Re: [DRAFT] Branching and merging with git, Theodore Tso, (Fri Nov 17, 11:32 am)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Fri Nov 17, 2:21 pm)
Re: [DRAFT] Branching and merging with git, J. Bruce Fields, (Sun Nov 19, 1:50 pm)
[PATCH] Documentation: add a "git user's manual", J. Bruce Fields, (Sun Nov 26, 12:01 am)
Git manuals, Petr Baudis, (Sun Nov 19, 1:59 pm)
Re: Git manuals, J. Bruce Fields, (Sun Nov 19, 3:36 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Fri Nov 17, 8:40 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Fri Nov 17, 9:11 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Wed Nov 22, 7:51 am)
Re: [DRAFT 2] Branching and merging with git, J. Bruce Fields, (Sun Dec 3, 9:19 pm)
Re: [DRAFT 2] Branching and merging with git, J. Bruce Fields, (Mon Dec 4, 3:23 am)
Re: [DRAFT 2] Branching and merging with git, Johannes Schindelin, (Mon Dec 4, 6:56 am)
Re: [DRAFT] Branching and merging with git, Sean, (Fri Nov 17, 11:57 am)
Re: [DRAFT] Branching and merging with git, Nguyen Thai Ngoc Duy, (Fri Nov 17, 12:19 pm)
Re: [DRAFT] Branching and merging with git, Sean, (Fri Nov 17, 12:34 pm)
Re: [DRAFT] Branching and merging with git, Marko Macek, (Fri Nov 17, 12:25 pm)
Re: [DRAFT] Branching and merging with git, Petr Baudis, (Fri Nov 17, 12:33 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Thu Nov 16, 9:09 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Fri Nov 17, 1:55 am)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Thu Nov 16, 7:47 pm)
Re: [DRAFT] Branching and merging with git, Junio C Hamano, (Thu Nov 16, 9:31 pm)