Here's how I view the checkout command: It is used to check out stuff from your git database into your working tree. Stuff here means either the whole tree or some files in it. You can check out a whole tree (branch) by specifying its sha1, or you can check out a single file by specifying the tree and the filename. The fact that checkout can be used to create a branch is just a convenience because most of the time it's easier to give the tree sha1 a name to refer to for further git commands.
This is exactly what I tell students in my Git courses during the first hour.
Git checkout is a command to read something from your .git-folder to your working directory.
Especially for people coming from ClearCase, the concept of Git checkout needs to be clarified as fast as possible. (In CC checkout means you make an element (file) editable for you, and possibly reserve it to you too)
Re:Git koans
by the_mitsuhiko on Monday April 08, 2013 @11:26AM
(#5512271)
> Isn't that violating 'doing one thing'?
Yes. But that violation would also be there if `git branch` would checkout. And in that sense, what's more odd "git checkout -b new-branch" or "git branch --checkout new-branch"?
Isn't that violating 'doing one thing'? (Your other examples in this point are valid, and serve to show how powerful building concepts on top of a few primitives can be, if confusing at times)