Re: git branch --switch?

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

 



On 4/17/07, Brian Gernhardt <benji@xxxxxxxxxxxxxxxxxx> wrote:

On Apr 17, 2007, at 10:21 AM, Alex Riesen wrote:

> Kind of. It can be done with git-read-tree. I.e.:
>
>  $ git-read-tree --index-output=.git/tmp-index <branch-name> && \
>     mv tmp-index .git/index && \
>     git update-ref HEAD <branch-name>

This does not appear to do what you think it will.  git update-ref
will write the SHA1 of <branch-name> into the current HEAD, not
switch HEAD to a new branch.


ach, right. Dangerous: it can change the ref HEAD points to. Very sorry!
Better just:

$ rm .git/HEAD && git symbolic-ref HEAD "refs/heads/<branch-name>"

In the end, you just have git-checkout minus git-checkout-index. Maybe
a "git-checkout -n" can be useful. Even though I can't imagine what for.
-
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]