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

From: Linus Torvalds
Date: Tue Jun 21 2005 - 12:12:47 EST




On Tue, 21 Jun 2005, Jeff Garzik wrote:
>
> Slight tangent... it would be nice if you would write a 2-line
> git-checkout-script, which provides the modern version of
>
> git-read-tree -m HEAD && git-checkout-cache -q -f -u -a
>
> Note that I do depend on this command blowing away working dir changes,
> but maybe you would want that to be a separate arg.

Added. Feel free to try it out, but it's very lightly tested.

You can do just "git checkout" and it will checkout the current HEAD, but
won't overwrite anything old. Use the "-f" flag to force overwrite.

It can also take a new HEAD, ie you can check out the parent of the
current HEAD by doing

git checkout HEAD^


and if you actually want to set the HEAD to that parent you can do so with
the "-u" flag, so

git checkout -u HEAD^

is basically equivalent to "undo the topmost commit".

It's not quite your "switch", though, because it will always _write_ to
the current HEAD, it won't be switching the current HEAD around to another
branch. I almost think that behavkiour would be more useful, I'll think
about how to do it sanely.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/