Gentoo Archives: gentoo-catalyst

From: Sebastian Pipping <sping@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] rfc: merging catalyst git branches
Date: Thu, 08 Dec 2011 23:44:11
Message-Id: 4EE14BB1.8020400@gentoo.org
In Reply to: Re: [gentoo-catalyst] rfc: merging catalyst git branches by William Hubbs
1 On 12/08/2011 10:42 PM, William Hubbs wrote:
2 >> The cleanest way to do this this in Git may be:
3 >>
4 >> # git checkout master
5 >> # git merge -s theirs catalyst_2
6 >>
7 >> Haven't tested it though.
8
9 Just noticed that I mis-read the git-merge man page: "theirs" is an
10 option of the recursive merge strategy. Sorry.
11
12
13 > I checked it out with the folks on #git, and they are recommending
14 > that I rename catalyst_2 to master. I was given a series of commands to
15 > do this.
16 >
17 > The down side is that this will cause a forced update, so everyone will
18 > have to re-clone the repository.
19
20 Actually there is a way to do this *without* the downside that you describe.
21
22 The trick is to create a fake merge commit using git commit-tree to sort
23 of emulate merge strategy "theirs". The commit to make needs to:
24
25 - point to catalyst_2^{tree} as its content.
26
27 - have current catalyst_2 as its *first* parent in order to
28 - indicate where the data actually came from
29 - make commands like "git show HEAD^" descend into
30 the old catalyst_2 branch later as that's the content
31 that matters
32
33 - have current master as the second parent
34 (so people can keep working without trouble)
35
36
37 This time I tested it myself. This is what to do:
38
39 1) Make sure your local master and catalyst are *both* up to date.
40
41 2) # git checkout master
42
43 3) Create and merge a fake merge commit as defined above:
44
45 # git merge $(git commit-tree catalyst_2^{tree} \
46 -p catalyst_2 -p master \
47 <<<"Replace content on master with content from catalyst_2")
48
49 Again, the *order* of parents matters.
50
51 4) Confirm it went fine, e.g. this diff should now be empty:
52
53 # git diff master catalyst_2
54
55
56 > The target time I am considering for this is Monday, Dec 11, 0:00 utc.
57 > What that means is, everyone needs to have their changes pushed by then,
58 > then I'll make the change and send out an email here once I'm done.
59 > Then, you will have to re-clone your repositories.
60 >
61 > Any comments?
62
63 Please consider the alternative explained above.
64
65 What do you think?
66
67
68 Best,
69
70
71
72 Sebastian