From owner-freebsd-x11@freebsd.org Wed Apr 5 22:22:25 2017 Return-Path: <owner-freebsd-x11@freebsd.org> Delivered-To: freebsd-x11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84185D305FA for <freebsd-x11@mailman.ysv.freebsd.org>; Wed, 5 Apr 2017 22:22:25 +0000 (UTC) (envelope-from per@hedeland.org) Received: from outbound1j.ore.mailhop.org (outbound1j.ore.mailhop.org [54.69.62.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6781EB96 for <freebsd-x11@freebsd.org>; Wed, 5 Apr 2017 22:22:24 +0000 (UTC) (envelope-from per@hedeland.org) X-MHO-User: 34d1c1c7-1a4e-11e7-bfb5-0d159cd3c324 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 81.228.155.109 X-Mail-Handler: DuoCircle Outbound SMTP Received: from hedeland.org (unknown [81.228.155.109]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 34d1c1c7-1a4e-11e7-bfb5-0d159cd3c324; Wed, 05 Apr 2017 22:21:27 +0000 (UTC) Received: from pluto.hedeland.org (pluto.hedeland.org [10.1.1.5]) by tellus.hedeland.org (8.15.2/8.15.2) with ESMTPS id v35MLDCl099240 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for <freebsd-x11@freebsd.org>; Thu, 6 Apr 2017 00:21:13 +0200 (CEST) (envelope-from per@hedeland.org) Subject: Re: Switching branches of freebsd-base-graphics with git To: freebsd-x11@freebsd.org References: <E7.99.29375.6FD94E85@dnvrco-omsmta02> <CAPS9+SvcSdcALYgRyhdw2oqE93cPUb94pzYsP=BDQQadLXfzmg@mail.gmail.com> <CAGhTqAW7aRiFtiM9XrcXVehdoxEMkckLCu651XM9oP7OTRZ1BA@mail.gmail.com> From: Per Hedeland <per@hedeland.org> Message-ID: <2f3febf3-fa2f-47d5-58d4-741d5cdc1729@hedeland.org> Date: Thu, 6 Apr 2017 00:21:13 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <CAGhTqAW7aRiFtiM9XrcXVehdoxEMkckLCu651XM9oP7OTRZ1BA@mail.gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support <freebsd-x11.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-x11>, <mailto:freebsd-x11-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-x11/> List-Post: <mailto:freebsd-x11@freebsd.org> List-Help: <mailto:freebsd-x11-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-x11>, <mailto:freebsd-x11-request@freebsd.org?subject=subscribe> X-List-Received-Date: Wed, 05 Apr 2017 22:22:25 -0000 On 2017-04-05 18:19, Doug Kirk wrote: > `git pull` is just sugar for `git fetch` (fetch remote updates) then `git > merge` (merge them into the current work tree). > > Since git pulls down the entire repo (unlike svn), `git checkout $branch` > is enough (AS LONG AS you originally cloned the entire repo instead of just > one branch -- `-b $branch` on the clone command). Well, I'm also far from a git expert, even though I've been struggling with it at $WORK for the last year or so.:-) But AFAIK, though there are ways to "limit" a clone, '-b <branch>' isn't one of them - it should be equivalent to doing a clone without -b followed by 'git checkout <branch>'. But I do think clone vs checkout (and of course git vs svn) is at the root of Thomas' problem, with the mistaken assumption that 'git checkout $REMOTE_REPO' will give you a local working tree just like 'svn checkout $REMOTE_REPO' does (I *still* make that mistake every now and then). So, as Doug writes, you need to 'git clone' *first*. And this summary of its commandline is all I've ever needed: git clone [-b <branch>] [<directory>] And with [-b <branch>] taken care of, I believe [<directory>] is the important thing regarding Thomas' subsequent problem. The man page (yeah, it has man pages!) says: <directory> The name of a new directory to clone into. The "humanish" part of the source repository is used if no directory is explicitly given (repo for /path/to/repo.git and foo for host.xz:foo/.git). Cloning into an existing directory is only allowed if the directory is empty. Thus 'git clone https://github.com/FreeBSDDesktop/freebsd-base-graphics.git', with or without -b, but without <directory>, will clone into $CWD/freebsd-base-graphics. If you want to clone into /freebsd-base-graphics, you need to give that path as the last argument - or, in this particular case, make sure $CWD is the root directory - but it needs to be non-existing or empty. (Personally I always use the <directory> argument, to make sure the clone ends up where I want it.:-) With that done, you should be able to cd into the local clone a.k.a. wotking tree and 'git checkout' (~= 'svn switch' AFAIK) and 'git pull' (~= 'svn update') to your heart's content.:-) --Per Hedeland > So after the checkout as above, `git pull` should be enough to get the > currently checked-out branch's updates from the remote repo. > > Even if you didn't clone the entire repo, `git checkout $branch` followed > by `git pull` is enough to checkout the branch and get its updates. > > You can get a (local & remote) branch list with `git branch -a`. It'll show > a star for the current branch. > > Also keep in mind that git won't do anything with non-tracked files, so > you'll likely want to `make clean` to get rid of prior-branch remnants. > > Cheers! > > On Wed, Apr 5, 2017 at 4:06 AM Andreas Nilsson <andrnils@gmail.com> wrote: > >> On Wed, Apr 5, 2017 at 9:33 AM, Thomas Mueller <mueller6722@twc.com> >> wrote: >> >>> I tried to switch freebsd-base-graphics tree from drm-3.8 (something like >>> that, now outdated to drm-next and made a mess. >>> >>> First, from /freebsd-base-graphics, I did >>> git checkout drm-next >>> but then git pull didn't work, I got message about not having repository. >>> >>> "git checkout drm-next" switched branches but didn't download anything, >>> hence my try with "git pull". >>> >>> After some struggle, I did >>> git clone https://github.com/FreeBSDDesktop/freebsd-base-graphics.git -b >>> drm-next >>> >>> from /freebsd-base-graphics directory, but that resuted in the tree being >>> downloaded to /freebsd-base-graphics/freebsd-base-graphics >>> >>> I recovered by renaming (mv) /freebsd-base-graphics to >>> /freebsd-base-graphics-old, then moved >> /freebsd-base-graphics-old/freebsd-base-graphics >>> to / >>> and then, with the new stuff separated from the old, >>> rm -R /freebsd-base-graphics-old >>> >>> That seemed to work, inelegantly. >>> >>> Question is how to switch the branch and download the new branch over the >>> old, like "svn sw", but with git. >>> >>> I looked through the documentation, even went to git-scm.org, even a PDF >>> book "Jump-Start Git" but still couldn't see what I should have done. >>> >>> There has to be a simpler way, but I couldn't find it in the >> documentation >>> of git. >>> >>> Tom >>> >>> _______________________________________________ >>> freebsd-x11@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-x11 >>> To unsubscribe, send any mail to "freebsd-x11-unsubscribe@freebsd.org" >>> >> >> >> Hello! >> >> I've switched branches a few time to keep track of progress and going from >> 11-STABLE to 12-CURRENT. I did >> >> git fetch ( this fetch info on new branches and code and so on ) >> git checkout $branch >> git pull >> >> >> Subsequent upgrades are done with >> >> git fetch >> git pull >> >> I'm by no means a git expert, so please correct me if I'm wrong. >> >> Best reagards >> Andreas >> _______________________________________________ >> freebsd-x11@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-x11 >> To unsubscribe, send any mail to "freebsd-x11-unsubscribe@freebsd.org" >> > _______________________________________________ > freebsd-x11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-x11 > To unsubscribe, send any mail to "freebsd-x11-unsubscribe@freebsd.org" >