git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-switch-tree script

From
JGJeff Garzik <jgarzik@pobox.com>
Date
May 23, 2005, 07:24 UTC
Message-ID
<42918526.1060406@pobox.com>
This is what I use to switch between branches, in my kernel trees.
	Jeff
#!/bin/sh
if [ "x$1" != "x" ]
then
	if [ "$1" == "master" ]
	then
		( cd .git && rm -f HEAD && ln -s refs/heads/master HEAD )
	else
		if [ ! -f .git/refs/heads/$1 ]
		then
			echo Branch $1 not found.
			exit 1
		fi
		( cd .git && rm -f HEAD && ln -s refs/heads/$1 HEAD )
	fi
fi
git-read-tree -m HEAD && git-checkout-cache -q -f -u -a
Message 1 of 1 in “git-switch-tree script”
  1. Jeff GarzikMay 23, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.