3 ms·
git switch --detach
by afdbcreid 2y ago
git switch --detach
- frizlab 2y agoor the shorter `git switch -d`
- lostmsu 2y agoNot to be confused with `git switch -D`, a shorthand for `git switch --delete`
- frizlab 2y agoAre you being sarcastic? I can’t find the --delete option in git-switch man page.
- lostmsu 2y agoI am. The fact that you had to look is the point.
- frizlab 2y agoI don’t see the point though. That it’s impossible to know all of git’s options by heart? I mean that’s obvious and true of most software (https://xkcd.com/1168/ https://xkcd.com/1168/ though this one is not actually hard).
- kazinator 2y agoI do see a point though. Ostensibly, sure, it's hard to be so confident that a program does not have a certain feature that you can deny it without looking. But think about this case. Would it make sense for git switch to have a delete option? Of course not. But you can't be sure, because, git. The feeling is that they would merge something like that.
- deleted 2y ago[deleted]
- kazinator 2y agoBut "git switch --detach master" leaves you detached. So switch is just a dumber checkout that has to be told when to detach or not instead of inferring it from the kind of revision.
- remram 2y agoThat's usually a good thing, setting your HEAD to a symbolic ref or a commit are very different operations. Having a switch makes sense and probably catches beginner errors rather than letting them know afterwards. I don't feel like typing 'git s -d <branch>' has slowed me down in practice but you're technically right of course (or I would add a 'd="switch -d'"' alias).