Re: If you would write git from scratch now, what would you change?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:
Steven Walter <stevenrwalter@xxxxxxxxx> 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux