From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: git pull fails with merge conflicts. How can this possibly happen? Date: Fri, 14 Nov 2014 21:54:04 +0000 Message-ID: <20141114215404.GD3168@acm.acm> References: <20141114183737.GB3168@acm.acm> <5466517B.50705@porkrind.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1416002136 5021 80.91.229.3 (14 Nov 2014 21:55:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Nov 2014 21:55:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Caldwell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 14 22:55:29 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XpOpy-0000kq-LO for ged-emacs-devel@m.gmane.org; Fri, 14 Nov 2014 22:55:26 +0100 Original-Received: from localhost ([::1]:37989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpOpy-00087l-Ba for ged-emacs-devel@m.gmane.org; Fri, 14 Nov 2014 16:55:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpOpR-0007jZ-V2 for emacs-devel@gnu.org; Fri, 14 Nov 2014 16:55:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpOpK-0005Uz-FN for emacs-devel@gnu.org; Fri, 14 Nov 2014 16:54:53 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:21590 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpOpK-0005UT-3d for emacs-devel@gnu.org; Fri, 14 Nov 2014 16:54:46 -0500 Original-Received: (qmail 84237 invoked by uid 3782); 14 Nov 2014 21:54:43 -0000 Original-Received: from acm.muc.de (pD95186C8.dip0.t-ipconnect.de [217.81.134.200]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 14 Nov 2014 22:54:42 +0100 Original-Received: (qmail 5270 invoked by uid 1000); 14 Nov 2014 21:54:04 -0000 Content-Disposition: inline In-Reply-To: <5466517B.50705@porkrind.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:177128 Archived-At: Hello, David. On Fri, Nov 14, 2014 at 11:01:15AM -0800, David Caldwell wrote: > On 11/14/14 10:37 AM, Alan Mackenzie wrote: > > I've now advanced from my last puzzlement. It turns out that "git > > clone" doesn't properly initialise the new repository. I had to do this > > manually with "git checkout emacs-24". > Git checkout looks for a branch with the name "emacs-24", failing that > it looks for one matching that in your remotes/* and copies that branch > into "emacs-24". Thus remotes/origin/emacs-24 should be copied to > emacs-24 (and you can check this in the .git/refs/* directory tree + > .git/packed-refs file—it's all text). How come "git clone" didn't work properly? Surely the branch structure in the original and the copy repositories should be identical. That's what "cloning" means. What exactly is this "remotes/*". When you talk about "copies that branch into "emacs-24"", is this copying within the repository, or from another repository into this one. Where is this described? > > This "git pull" leaves a mass of merge conflicts. How can this be? > > What does git pull actually do? The git pull man page says: > > "Incorporates changes from a remote repository into the current > > branch. In its default mode, git pull is shorthand for git fetch > > followed by git merge FETCH_HEAD." > The man page is correct. :-) > > acm@acm ~/emacs/emacs.git/emacs-24 $ git branch -a > > * emacs-24 > > master > > remotes/origin/HEAD -> origin/master > > remotes/origin/emacs-24 > > remotes/origin/master > > acm@acm ~/emacs/emacs.git/emacs-24 $ git pull I notic here that "emacs-24" has the *, but "remotes/origin/HEAD" -> "origin/master". Could this have something to do with my failed git pull? Unfortunately, only the syntax of "remotes" is described in the git glossary, not its semantics. > This is the "git fetch" part of "git pull": > > remote: Counting objects: 32, done. > > remote: Compressing objects: 100% (16/16), done. > > remote: Total 32 (delta 26), reused 22 (delta 16) > > Unpacking objects: 100% (32/32), done. > > From /home/acm/emacs/emacs.git/master/. > This is the "git merge" part: > > + 911ad4a...6688117 emacs-24 -> origin/emacs-24 (forced update) > The problem is the 911ad4a. If you look at that commit it is on the > master branch. This implies that your local emacs-24 branch was not > *really* the emacs-24 branch (Maybe you accidentally did "git checkout > -b emacs-24"?). I don't think I did, but anything's possible. > Git matched the "emacs-24" name to the "origin/emacs-24" and merged that > in, but since your emacs-24 branch was was really just master you got a > bunch of merge conflicts. > That is my guess anyway, it's hard to tell without seeing your repo. If > you "git reset" then "git log", which commit is first? If it's the > 911ad4a then you aren't really on the emacs-24 branch. It's too late at night to start trying to make sense of the git reset man page. I'll have a look at that tomorrow. > You can try poking around with gitk to see how the branches interact. I > also quite like the "tig" tool (not part of git)—it's sort of a curses > version of gitk. gitk doesn't work on my system, of course. (Nothing ever does without a lot of effort). Funny thing: looking at the gitk man page, there doesn't appear to be a way of specifying the repository. Hmm. > -David -- Alan Mackenzie (Nuremberg, Germany).