git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jay Soffian <jaysoffian@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [ANNOUNCE] GIT 1.6.2-rc1
Date: Mon, 16 Feb 2009 13:42:59 -0800	[thread overview]
Message-ID: <7vvdradpng.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 76718490902160902q50c0d730j4f18664455626b93@mail.gmail.com

Jay Soffian <jaysoffian@gmail.com> writes:

>  master> git checkout next
>    next> git branch --track mybranch @{-1}
>
> Creates "mybranch" from master, *not from next*, correct?
>
> Also, the "--track" option is an unnecessary distraction to the
> example, isn't it?

When a new branch is created in "git branch --track A B" form, B is used
in two ways.

 * Obviously, the new branch A initially points at the same commit as
   commit B.  For this, B does not have to be the name of a branch.  It
   only has to be a commit-ish.

 * With --track, the new branch A is marked as a fork of the branch B, but
   obviously for this additional feature to kick in, you cannot give an
   arbitrary commit-ish as B.  It has to be the name of a branch you are
   forking from.

If B were spelled @{1}, the latter does not happen, as @{1} is a way to
say "The _commit_ my current branch was pointing at before it point the
current commit".  On the other hand, @{-1} is a way to say "The _branch_
I switched from my last 'git checkout' command", and the command ought to
behave the same as if you gave it a branch name, and --track takes place.

So having --track explicitly in the example is a good way to clarify the
point that @{-N} notation is a way to spell _a branch name_, and it is not
merely another commit-ish.

      reply	other threads:[~2009-02-16 21:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16  9:04 [ANNOUNCE] GIT 1.6.2-rc1 Junio C Hamano
2009-02-16 16:38 ` Matt Kraai
2009-02-16 17:02 ` Jay Soffian
2009-02-16 21:42   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vvdradpng.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).