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

Re: git branch --switch?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 17, 2007, 16:44 UTC
Message-ID
<Pine.LNX.4.64.0704170938510.5473@woody.linux-foundation.org>
In-Reply-To
<4624F4BB.7010308@gmail.com>
On Tue, 17 Apr 2007, Rene Herman wrote:
Show 8 quoted lines
> On 04/17/2007 05:41 PM, Rene Herman wrote:
> 
> > You'd be quite right in saying that there isn't much point; if I want to now
> > start populating branch a, I have to "git checkout a" anyway, and that
> > action _will_ now be instantaneous.
> 
> Actually, I take that back, it's not instantaneous at all. 1995 systems are
> much better at showing long delays than those fancy modern computers are!
You'll always have at least _one_ slow checkout. If you checkout at all.

The kernel archive is 8 million lines - 240MB or so checked out. Writing out that 240 MB to disk is not going to be instantaneous even on a modern machine, although having so much memory that you can ignore the writeout and let it happen in the background will certainly help.

If you don't need to build the tree, you can avoid the checkout entirely, of course. Most git operations don't actually need a checked-out tree at all, and you could even have done a bare clone and just inspected it with git tools if that's what is wanted.

So you could have avoided the checkout completely, and done
	git clone -l -s -n <a local linux repo> local
	git branch v20 v2.6.20
	git branch a v20
	git branch b v20
	git branch c v20

and now you'd have four branches that all point to the v20 thing, and none of them are actually checked out. And all of that would have been instantaneous, even on an old machine (apart fromt he clone itself, of course ;)

But the moment you decide to write 240MB to disk, you'll be slow.
			Linus
Previous: Rene HermanNext: Rene Herman
Message 17 of 18 in “git branch --switch?”
  1. Rene HermanApr 17, 2007
  2. Alex RiesenApr 17, 2007
  3. Rene HermanApr 17, 2007
  4. Brian GernhardtApr 17, 2007
  5. Alex RiesenApr 17, 2007
  6. Rene HermanApr 17, 2007
  7. Brian GernhardtApr 17, 2007
  8. Rene HermanApr 17, 2007
  9. Rene HermanApr 17, 2007
  10. Lars HjemliApr 17, 2007
  11. Rene HermanApr 17, 2007
  12. Randal L. SchwartzApr 17, 2007
  13. Rene HermanApr 17, 2007
  14. Lars HjemliApr 17, 2007
  15. Rene HermanApr 17, 2007
  16. Rene HermanApr 17, 2007
  17. Linus TorvaldsApr 17, 2007
  18. Rene HermanApr 17, 2007

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.