Hacker News new | past | comments | ask | show | jobs | submit login

If you think of "git checkout" as "update the working copy", doing all those things with a single command makes a lot of sense.

The "create a new branch" functionality doesn't really belong in your list, since branches are created with "git branch". The -b switch is provided for checkout because _updating the working copy_ and creating a new branch is a very common sequence.

To be honest, I have yet to find anything I particularly dislike about git's approach. For some things, it took a while to see why it is the way it is, but in the end I find it fairly sensible. In my opinion, git just does things right on a fundamental level[1], which I find more important than UI issues.

[1] Compared to hg, especially the 'a branch is just a pointer' approach. I know of the bookmarks extension for hg but in the end I just used hg-to-git for the one hg repository that I follow.




> If you think of "git checkout" as "update the working copy", doing all those things with a single command makes a lot of sense.

The problem is that "update the working copy" isn't accurate.

When you 'git checkout my-feature-branch' you "update the working copy" AND "switch the current branch to my-feature-branch".

When you 'git checkout fa230bc -b new-branch' you "update the working copy" AND "create a new branch".

> The "create a new branch" functionality doesn't really belong in your list, since branches are created with "git branch". The -b switch is provided for checkout because _updating the working copy_ and creating a new branch is a very common sequence.

It absolutely does belong in the list. The problem is not simply that 'git checkout' can do a lot -- it's that the documentation is very hard to scan because it can do a lot. Adding the -b switch adds to the problem because now you have to mention how this option interacts with the others (and give examples of how to use it in the Examples section).

Sure, if I want to create a new branch at a specific revision then the -b switch saves me a few keystrokes -- but it also makes the documentation for 'git checkout' harder to quickly find what I'm looking for whenever I want to look up something, even if it's completely unrelated to branch creation.


I always looked at -b this way: git checkout <branch> updates my working copy to some branch. -b just means "Implicitly create the branch if it doesn't exist yet."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: