| ▲ | nightski 6 hours ago | ||||||||||||||||||||||||||||
I stand corrected by this one scenario, but I’ve been using git for over a decade and never found that useful. Just don’t use checkout on a file path, there is no need. | |||||||||||||||||||||||||||||
| ▲ | saghm an hour ago | parent | next [-] | ||||||||||||||||||||||||||||
"Just don't accidentally do things wrong" is also the way to avoid null pointer errors, type mismatches in dynamically typed languages, UB in C/C++. It works, until it doesn't, and in practice that happens pretty quickly. Personally, I like things that have proper safety checks. | |||||||||||||||||||||||||||||
| ▲ | sswatson 6 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
I find this kind of advice to be a more scathing indictment of an interface than a critic could ever muster: asking users to forego available functionality so that some sense of order can be imposed. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ▲ | hollowcelery 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
Interesting - I use git checkout constantly, whenever I have a file in another branch or commit that I want to drag into this one wholesale. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
| ▲ | tom_alexander 5 hours ago | parent | prev [-] | ||||||||||||||||||||||||||||
If you don't run checkout on file paths, how do you undo changes to specific files that you haven't committed yet? Like you've edited but not committed <foo>, <bar>, and <baz>. You realize your edits to <bar> are a mistake. I'd just run `git checkout <bar>` to revert those changes, what do you do? It is also really useful when you realize you want <bar> to be the version from a commit two weeks ago. I guess you could always switch to the branch 2 weeks ago, copy the file to /tmp/, switch back, and copy the file into place, but `git checkout c23a99b -- <bar>` is so quick and easy. Or does this example not fall under the "dont run checkout on a path" since it is taking a treeish first before the path? | |||||||||||||||||||||||||||||