Gentoo Archives: gentoo-dev

From: Michael Orlitzky <michael@××××××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Portage Git migration - clean cut or git-cvsserver
Date: Thu, 31 May 2012 20:29:15
Message-Id: 4FC7D444.4080009@orlitzky.com
In Reply to: Re: [gentoo-dev] Re: Portage Git migration - clean cut or git-cvsserver by "Michał Górny"
1 On 05/31/12 16:09, Michał Górny wrote:
2 > On Thu, 31 May 2012 15:58:43 -0400
3 > Rich Freeman <rich0@g.o> wrote:
4 >
5 >> On Thu, May 31, 2012 at 3:33 PM, Michał Górny <mgorny@g.o>
6 >> wrote:
7 >>> What would git signing work with rebased commits? Would all of them
8 >>> have to be signed once again?
9 >>>
10 >>
11 >> The whole point of rebasing is to throw away history (which is either
12 >> good or bad based on your perspective).
13 >>
14 >> So, if 14 devs spend 3 years and 2000 commits working on something in
15 >> a branch, and I commit it to master using a rebase, then all you'll
16 >> see in the master history is that rich0 committed 20k lines of code to
17 >> master on May 31st, and that would be signed by me.
18 >>
19 >> I think that rebasing before merging is a pretty typical workflow
20 >> anyway - when you submit a patch to Linus, he doesn't really care that
21 >> you spent six months tweaking it - he just is getting a big blob of
22 >> code that either works or doesn't. Does all that sub-history really
23 >> matter? You could always push the branch to the repository if you
24 >> wanted to keep it on the side.
25 >
26 > That sounds like a pretty poor workflow to me. If I tweak something for
27 > 3 years, I'm likely to have a larger set of logically organized commits.
28 > I'm not saying it's unlikely I'm going to rebase fixes for obvious
29 > mistakes but putting everything onto one blob just makes the changes
30 > harder to read and less maintainable.
31 >
32 > For example, if I first create a basic function and then add additional
33 > options to it, I'm likely to keep those as separate commits. If one of
34 > the changes was a really bad idea, I'd like to revert the appropriate
35 > commit rather than removing all traces of it by hand and mistakenly
36 > introducing even worse breakage.
37 >
38
39 That isn't what rebasing does, unless you do an interactive rebase and
40 decide to squash the commits.
41
42 The usual use case for a rebase is just to avoid the ugly merge commit.
43 For example,
44
45 1. I clone your portage tree
46 2. I start making commits locally
47 3. You add a new package
48 4. I try to push my changes to you
49
50 Step 4 doesn't work because your repo has changed. I can either,
51
52 a) pull from you again (merge)
53 b) pull with a rebase
54
55 And then I should be able to push to you, assuming there were no conflicts.
56
57 The merge option works fine but generates an ugly merge commit. The
58 rebase takes our two histories and combines them into a nice linear
59 history. In this case, a rebase would (essentially) take all of my
60 commits and stick them on top of your "new package" commit. Afterwards,
61 it looks like there's a nice linear history: you added a package, and
62 then I did a bunch of other stuff. All of the commits are there.
63
64 Since that history is linear and it looks like just a bunch of stuff on
65 top of your existing tree, I can push it to you without problems.
66
67 The only downside to the rebase is that it modifies my local history.
68 So, if somebody cloned *my* repo in the middle of that, they could get
69 screwed up.

Replies