3 ms·
I have "truly learned git" (including having written a clone for a school project) and still hate the CLI and conventional Git workflow. Why is checkout overloa
by tylerhou 3y ago
I have "truly learned git" (including having written a clone for a school project) and still hate the CLI and conventional Git workflow. Why is checkout overloaded to mean "restore a file from the index" or "move to a different branch" or "move to a different commit?" Why can reset mean both "un-add a file" or "delete a commit?"
I am very happy that there are better frontends for git like Gitless or Facebook's Sapling. I also think their commands are more of a 1:1 mapping to "raw" git operations behind the scenes.
- charrondev 3y agoTo be fair even if those commands are still overloaded there are new commands that aren’t overloaded. (git restore for example now has its own command).
- Viliam1234 3y ago"git checkout" is a deprecated command, use "git switch" to switch to a commit, and "git restore" to restore a file
- voidfunc 3y agoTell that to Google and all the top results for switching to a commit which everyone usually phrases as "git howto checkout commit"
- chipotle_coyote 3y agoAs of the current git release (v2.41.0), there is nothing in the documentation for "checkout" indicating it is deprecated, while the documentation for "switch" contains the phrase -- in all caps, like this -- "THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE." One presumes checkout will eventually be deprecated by switch, but it isn't yet.
- DanielVZ 3y agoI guess that warning is to prevent people from using it on a script because it’s not a stable command. But for normal shell usage, it’s the preferred method.
- yCombLinks 3y agoPreferred how? I get a warning when I use checkout? Who is teaching me it's preferred? Am I expected to keep up with a community newsletter to use my version control tools?
- pwdisswordfishc 3y agoPreferred by whom?
- askvictor 3y agoWhere is one supposed to learn this sort of thing? If the cli doesn't tell you when you use it, there's no way a lot of people will discover this.
- smolsky 3y agoAll good critique. Not sure whether it's better to overload a command or force users to remember multiple ones... I used Mercurial 12 years ago before learning Git - it was a great stepping stone. I loved `hg` CLI as things made sense for the workflow.