From: Alex Riesen Date: Tue, 17 Apr 2007 14:21:29 GMT Subject: Re: git branch --switch? Message-ID: <81b0412b0704170721i2b64999aqbd0d7489074454d6@mail.gmail.com> In-Reply-To: <4624CD58.90103@gmail.com> On 4/17/07, Rene Herman wrote: > Is it possible to switch the current branch without checking it out? Not > really essential, but I'm happily flaundering around with git and still > start from scratch fairly regularly; to speed this up I've found the -n > switch to git clone useful and would like something similar when > reconstructing my "branch hierarchies". > > Upto now I only know about "git checkout" (with or without -b) to switch the > current branch. As said it's not really essential, but I was expecting there > would be something like a "branch --switch". Did I overlook it? Kind of. It can be done with git-read-tree. I.e.: $ git-read-tree --index-output=.git/tmp-index && \ mv tmp-index .git/index && \ git update-ref HEAD