7 ms·
"How should I change to a different branch?" asked the programmer. "Use git checkout." "And how should I create a branch?" "Use git checkout." "And how shou
by strictfp 5y ago
"How should I change to a different branch?" asked the programmer.
"Use git checkout."
"And how should I create a branch?"
"Use git checkout."
"And how should I update the contents of a single file in my working directory, without involving branches at all?"
"Use git checkout."
https://stevelosh.com/blog/2013/04/git-koans/ https://stevelosh.com/blog/2013/04/git-koans/
- chrisfosterelli 5y agoIn fairness, git has improved on this and separated these into `git switch` / `git restore`
- Izikiel43 5y agoFirst time I hear about this
- strictfp 5y agoYeah, but they denied the problem for the longest time, so they deserve some flak for it :)
- chrisfosterelli 5y agoProbably true. IMO the crime of checkout is that the command really is `git checkout <tree> -- <path>`, which updates that local path to match that git tree, but it implicitly fills `tree` with the current branch and `path` with all files. It actually makes sense if you learn the full command but makes zero sense when you google individual common operations and then they thought "this command should also have a shorthand to create branches" I suppose
- rezonant 5y agoI don't even use *the multiple uses of `git checkout`. It may be suboptimal but I think it's easier to quickly recall in my mind-- `git branch name` to create a branch and `git checkout branch` to check out a branch. `git checkout` for restoring files is dumb though, but as others have mentioned the UX has been improved with `git restore`
- TeeMassive 5y ago> It actually makes sense if you learn the full command but makes zero sense when you google individual common operations I call this "hacker tunnel vision". It is a state afflicting a lot of programmers at the top of their game when it comes to writing end-user API and documentation. It can be summarized by "it is so obvious that people will think I'm mocking them for explaining this"
- wombatpm 5y agoI had a calculus teacher who would routinely use IOTTMCO for various proofs. Intuitively Obvious to the Most Casual Observer, follow by a 5 page derivation
- Lhiw 5y agoThis is because git is a tool to interact with the git tree, not the mental models you've built on top of it or imported from other tools. Git checkout covering multiple usecases makes sense to me, I've never thought, hey this is used for all these different things they should be separate. I think, hey, this tool is always checking out a hash and a path. The fact that can be a branch or a commit is entirely inconsequential. If it irks you it's because you think there is a difference between a branch and a commit then you're likely lacking some fundamental understanding about git.
- Riverheart 5y agoGit is a tool to get work done and is used by people besides programmers (sysadmins, data analysts). If people don't understand everything is a hashed commit its Git's fault for introducing distinctions without making the cli reflect those distinctions, not because those people didn't take a data structures course on Git.
- Minor49er 5y agoThis reminds me of The Tao of Programming http://www.mit.edu/~xela/tao.html http://www.mit.edu/~xela/tao.html
- xupybd 5y agoYes coming from Mercurial I find Git very confusing.
- TeeMassive 5y agoOnce I understood that git was basically a DAG of filesystem snapshots enforced by hashes then everything started to make sense very quickly. I'd even argue that hiding this fact is what makes all of the other CVS a pain in the ass to use because they are trying so hard to hide the truth from their users.
- aidenn0 5y agoOther VCSs aren't a DAG of filesystem snapshots enforced by hashes. For example SVN is strictly a linear snapshot of a single tree.
- TeeMassive 5y agoSVN is effectively a badly designed database. Git has a much more effective and simple data structure because each command correspond to a way to work with it and external tools and extensions and future version of git can work with that very easily.
- yalok 5y agoI had a very similar reverse experience- coming from git, Mercurial felt very confusing and limited…