From: Adam Roben Date: Mon, 26 Nov 2007 06:36:58 GMT Subject: Re: If you would write git from scratch now, what would you change? Message-ID: <474A698A.70100@apple.com> In-Reply-To: <7vejedh6xl.fsf@gitster.siamese.dyndns.org> Junio C Hamano wrote: > Steven Walter writes: > >> Heartily seconded. I think checkout is the most egregrious of the >> three. git-checkout can be used to: >> >> * Switch branches >> * Create a branch >> * Change the state of all files to a particular commit >> * Change the state of a particular file to that of the index >> * Change the state of a particular file (and index) to a particular >> commit >> > > Come on. The second one is just to give a short-hand side-effet for > commonly used operation and you do not have to use it nor learn it. > I think the overwhelming majority of git users learn `git checkout -b`. The cases where you do want to switch to a branch you just created seem far more common than the cases where you don't (particularly for new users), which is the whole reason the -b option exists in the first place. So I don't think it's reasonable to say "you can choose not to be confused by ignoring this incredibly useful command." > Let's clear the confusion. Although it is not bad like the above > "random 5 different operations", checkout does serve 2 quite different > purposes: > > (1) checkout a revision. > (2) checkout selected paths out of a commit (or the index). > Given the above, I'd argue that it serves 3 purposes: (1) check out a revision (2) check out selected paths out of a commit (or the index) (3) start working on a new branch It's true that (1) and (3) are very closely related, but I think in the minds of many git users (particularly new ones) they are distinct. (2) really seems the most out of place here, and has the most potential for finding a new home (perhaps within git-reset). -Adam