From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH] checkout --track: make up a sensible branch name if '-b' was omitted Date: Sat, 09 Aug 2008 12:46:36 -0700 Message-ID: <7vvdya55ur.fsf@gitster.siamese.dyndns.org> References: <7vtzdu6nb7.fsf@gitster.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org, gitster@pobox.com To: Johannes Schindelin X-From: git-owner@vger.kernel.org Sat Aug 09 21:47:56 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1KRuPk-0006gN-Ej for gcvg-git-2@gmane.org; Sat, 09 Aug 2008 21:47:48 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752033AbYHITqq (ORCPT ); Sat, 9 Aug 2008 15:46:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752031AbYHITqq (ORCPT ); Sat, 9 Aug 2008 15:46:46 -0400 Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:59376 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003AbYHITqp (ORCPT ); Sat, 9 Aug 2008 15:46:45 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 29C4954E48; Sat, 9 Aug 2008 15:46:44 -0400 (EDT) Received: from pobox.com (ip68-225-240-211.oc.oc.cox.net [68.225.240.211]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 61E1454E47; Sat, 9 Aug 2008 15:46:40 -0400 (EDT) In-Reply-To: <7vtzdu6nb7.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Sat, 09 Aug 2008 11:44:12 -0700") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Pobox-Relay-ID: E5009B7A-664B-11DD-9892-CE28B26B55AE-77302942!a-sasl-fastnet.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Junio C Hamano writes: > Johannes Schindelin writes: > >> What does the user most likely want with this command? >> >> $ git checkout --track origin/next >> >> Exactly. A branch called 'next', that tracks origin's branch 'next'. > > I like this. > > An explicit --track request from the command line (as opposed to happening > to have "branch.autosetupmerge" configuration) is a very good cue that > what the user wants to do is not to take a peek on a detached HEAD but a > more permanent playpen created. A couple more thoughts. (1) You may not necessarily are used to --track, but may still want this done. It might not be a bad idea to associate this "local dwimming" to creation of a new branch. In other words, all of these: $ git checkout -b origin/next $ git checkout -b --track origin/next $ git checkout --track origin/next may merit the same dwimming. (2) If you work with somebody else, you might not want to have the name mapping to be "s|^[^/]*/||" (i.e. drop "origin/"): $ git remote add -f jeff $url_to_his_repository $ git checkout -b [--track] jeff-next jeff/next $ git checkout -b [--track] origin-next origin/next