Re: git-pull-script on my linus tree fails..

Linus Torvalds
2005-06-21T18:06:26Z

On Tue, 21 Jun 2005, Jeff Garzik wrote:
>
> If I want my working dir updated to reflect the desired branch -- the
> whole purpose of git-switch-tree -- I would have to do
>
> git-checkout-script && switch HEAD && git-checkout-script

No, you don't understand. The git-checkout-script already takes a
parameter to indicate _what_ to check out. It just defaults to head.

So you'd do

git-checkout-script branch && switch branch

and you'd be done.

Anyway, I liked the branch semantics for "git checkout" so much that I
just made it do that by default. In other words, if you do

git checkout 'branch'

it will both check out the new branch contents and switch HEAD to branch.
It will refuse to overwrite any data, but as before, you can force that
with "git checkout -f branch" instead.

If the argument to "git checkout" isn't a branch-name, but some other
name (like "v2.6.12" or an extended expression like "HEAD^" for "parent of
HEAD"), it will just check it out, but it obviously won't be switching any
branches around (and it will leave HEAD untouched).

These seem like sane and useful semantics, and your "switch" script should
really fall out as "git checkout -f".

Linus