Tim Starling
<tstarling(a)wikimedia.org> wrote:
I wrote:
It doesn't work, I'm afraid. Because of
the implicit rebase on push,
usually subsequent changesets have a different parent. So when you
diff between the two branches, you get all of the intervening commits
which were merged to the master.
I was hoping that someone was going to say "you're wrong, making those
diffs is easy, here's how." But I take it by the silence that I'm not
wrong, and it really is hard.
I just tried to push second commit to
https://gerrit.wikimedia.org/r/#change,3841
patchet three.
If you don't start from "scratch" i.e. base your commit on the parent:
8824515e571eadd4a63b09e1331f35309315603f
(now I have
$ git log HEAD ^HEAD^^^
commit e67af5bbd843db3062cc0082254b69aae3d1241b
Author: saper <saper(a)saper.info>
Date: Wed Mar 28 22:06:17 2012 +0200
An example how a foreign key should be added to the table
Change-Id: I0da5b25f4b4499facac6c410fa7ab74250935288
commit 96692fb23c00cb726144290b108623896cf24834
Author: Marc A. Pelletier <marc(a)uberbox.org>
Date: Tue Mar 27 22:44:32 2012 -0400
(bug 5445) remove autoblocks when user is unblocked
(...comment truncated...)
Change-Id: I4aa820ae9bbd962a12d0b48b6c638a1b6ff4efc9
This is the current HEAD:
commit 8824515e571eadd4a63b09e1331f35309315603f
Author: Santhosh Thottingal <santhosh.thottingal(a)gmail.com>
Date: Wed Mar 28 11:25:45 2012 +0530
Trying to commit e67af5bbd843db3062cc0082254b69aae3d1241b
makes gerrit say:
! [remote rejected] HEAD -> refs/changes/3841 (squash commits first)
It does not matter if I use the same change ID or not. It knows
exactly where it should go but it still refuses it.
I have managed to workaround this by creating a branch, doing
lots of commits there, merging it, and push the merge to gerrit.
But then it uploads lots of unrelated changets:
https://gerrit.wikimedia.org/r/#change,3706
https://gerrit.wikimedia.org/r/#change,3707
https://gerrit.wikimedia.org/r/#change,3708 (but this was outside of the branch)
https://gerrit.wikimedia.org/r/#change,3709
The commit tree looked like:
private branch: 3706 --- 3707 ---
/ \
62562768cf8f2696 + -------- 3708 ----+ 3709 (merge)
As you can see, although there were so many changesets,
they all have dependencies set properly.
Is this a better way? I don't know...
I wonder why in this case gerrit does not complain
with its usual (squash commits first)
Having private branches with other people
would certainly help to work together on issues.
I tried to submit an improvement to
https://gerrit.wikimedia.org/r/#change,3841 and
it seems I can't do this the other way than
rebasing my changes to the parent of the changeset
(*not* master). Not sure how to make a branch
out of it (maybe I should merge it with the parent
commit?)
//Saper