News for hackers. Stuff that matters.
Re:Fast by nine_k on Wednesday July 05, 2023 @06:21PM (#36608012)
Most of the inconsistencies, like "checkout" having three different functions, were added much later, in attempts to make UX niftier locally, without thinking about the product as a whole.
Re:Fast by arrowsmith on Wednesday July 05, 2023 @08:21PM (#36609197)
Checkout can move your head to different commit and it can copy files to your working tree from a non-checked-out commit. What's it's third function?
Re:Fast by nine_k on Wednesday July 05, 2023 @08:23PM (#36609209)
It can create a branch with -b, based on a branch of your choice (not necessarily current).

I constantly use this, having created an alias:

  [some other branch]$ git cob feature/foo123 main
Re:Fast by scubbo on Wednesday July 05, 2023 @09:01PM (#36609546)
Eh, I can squint and see that as a special-case of moving your head to another ref - the `-b` merely flagging "if this branch doesn't exist, create it instead of erroring".
Re:Fast by nine_k on Wednesday July 05, 2023 @09:34PM (#36609797)
It's a bit like building a train station is a special case of arriving to it :)
Re:Fast by m463 on Thursday July 06, 2023 @03:52AM (#36612640)
maybe like mkdir + chdir
Re:Fast by golergka on Saturday July 08, 2023 @10:13PM (#36650843)
It's arriving at it with trucks and bulldozers and other equipment repeatedly, but essentially yes.
Re:Fast by JimDabell on Thursday July 06, 2023 @12:18AM (#36611217)
For what it’s worth, this is now being separated out a bit to be clearer. You can use `git switch <branch>` to switch to an existing branch, `git switch --create <branch>` to create a new branch and switch to it, and `git restore <file>` or `git restore --source <ref> file` to restore a version of a file to your working directory.