Re: [ANNOUNCE] GIT 1.6.2-rc1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay Soffian <jaysoffian@xxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux