Return-Path: Delivered-To: apmail-infrastructure-dev-archive@minotaur.apache.org Received: (qmail 9314 invoked from network); 4 Apr 2011 21:18:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Apr 2011 21:18:21 -0000 Received: (qmail 40936 invoked by uid 500); 4 Apr 2011 21:18:21 -0000 Delivered-To: apmail-infrastructure-dev-archive@apache.org Received: (qmail 40831 invoked by uid 500); 4 Apr 2011 21:18:21 -0000 Mailing-List: contact infrastructure-dev-help@apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: infrastructure-dev@apache.org Delivered-To: mailing list infrastructure-dev@apache.org Received: (qmail 40823 invoked by uid 99); 4 Apr 2011 21:18:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 21:18:21 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=10 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.212.50 as permitted sender) Received: from [209.85.212.50] (HELO mail-vw0-f50.google.com) (209.85.212.50) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Apr 2011 21:18:15 +0000 Received: by vws14 with SMTP id 14so5925805vws.23 for ; Mon, 04 Apr 2011 14:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=JFYVxAErABaGV5ZbRjCFqoLmq7eHGnBiayKohWNZYwU=; b=e82+UZlNuDPEbuZjm20r3daCVkrQgaiEWGRrOOHIBh+c3sycMOw4OlKCrRsKh5v0Xs ZvrhVdkdFUqYUzrPjMwgX2VyZfaa7T0tWGV/+EoKMq25/eW45c3hJSrI80xQQg8TleUS CxQaLHFIlGhbfT6ZKyQt+1/VECPOGPljSSizo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=uY3n/ecfTzVvtWS8xlB3Qc3lMsaK6rqqF/qMlyYHsX48XQvZ4CPoA1knqMYiXLanzF r3iu9yFBBQe2LI/4RDjStgrZaiuTbENGpTfyyjAv/dPjTsr4juhKJl2FiGjLALDyJhM+ abTM3LwxI4/rEaxQv/uFwm6eHK3W8hesxfw6k= Received: by 10.52.70.162 with SMTP id n2mr233130vdu.268.1301951874106; Mon, 04 Apr 2011 14:17:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.165.4 with HTTP; Mon, 4 Apr 2011 14:17:14 -0700 (PDT) In-Reply-To: References: <02f801cbf1ca$ad4b9290$07e2b7b0$@16degrees.com.au> <80EF617B-462D-4A57-AB56-C55472952486@gmail.com> <63228BD0-C74B-478B-ADD1-30C3D20933D2@yahoo.com> From: Paul Davis Date: Mon, 4 Apr 2011 17:17:14 -0400 Message-ID: Subject: Re: Current use of GitHub To: infrastructure-dev@apache.org Cc: David Jencks Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > //do some work locally, committing to local git. > > git svn rebase // pull in other changes from apache > git push -u github //I don't remember the exact command I used, but it di= d get my local changes to a github branch named feature1 > > //do some more work locally, committing to local git. > //no one else changed the github branch AFAICT > > git svn rebase // pull in more apache changes, resolving merge conflicts > > I now can't push my local changes to the same feature1 github branch. =A0= My theory about why is that I've reordered history on my local git compared= to the existing github branch. =A0I have no way to verify this :-). =A0I g= uess I could create a new github branch every time I push??? > David, Bottom line is that this is because when you rebase, you've changed the history of your branch. Since you did the first rebase before you pushed, this is fine, when you do the second rebase, it changes the commits you did locally before, which causes your local branch history to diverge from the branch at your GitHub remote. Think of the commit pattern like such: SN commit N from svn LNM local commit N, version M // do some work locally S0 -> L10 -> L20 git svn rebase S0 -> S1 -> S2 -> L11 -> L21 git push github feature_name # GitHub now has L31 as the head for branch feature_name // more local work S0 -> S1 -> S2 -> L11 -> L21 -> L30 git svn rebase S0 -> S1 -> S2 -> S3 -> L12 -> L22 -> L31 // Now you can't push this is because your local branch has L31 as the head, and the GitHub branch is still L30. This is what's referred to a non fast forward push. You'll notice that both branches have commit S2 as the most recent commit in common. Now is the part where I write something that gets me branded as a heretic. To fix this, just do: $ git push -f github feature_name This will forcefully overwrite your remote branch so that it points at L31. Most people will tell you to never rebase something that has been pushed publicly. Generally that's true. For instance, you should never ever rebase your stable branches (master, version branches etc) that people might be using to develop against. On the other hand, if I have a public tracking branch of some wip, I'll rebase at will, treating it solely as a way for people to keep an eye on what I'm hacking on. I'll note that the alternative to this work flow is to svn rebase a local checkout of trunk, and then merge that into your feature branch. This will ensure that you'll always have fast forward updates when you push to GitHub. On the other hand, when you go to extract the work from your feature branch it can become much more difficult if you want to do anything more complicated than a single patch.