logoalt Hacker News

git's –end-of-options Flag

157 pointsby Erenay09last Tuesday at 1:13 PM93 commentsview on HN

Comments

metadattoday at 4:26 AM

Does anyone know why git broke the long standing convention of "--" early on? Kind of a nightmare for humans to use.

Remembering app-specific one-offs is kind of the worst!

show 7 replies
bombcartoday at 9:24 AM

This is actually one of the few places powershell begins to do something close to shine - the cli mixes data and commands in a way that we really shouldn't have to do.

The saddest thing is even ASCII has characters to help with this but since keyboards can't type them nobody used them.

yoberttoday at 4:31 AM

So I should name my next branch ‘--‘ is what I'm hearing :)

show 1 reply
bradley13today at 4:48 AM

As with almost any successful system: more and more special features and edge cases get added. Git has become ridiculously complex.

I wonder: would it not be better to tell users with those edge cases to fix their problems some other way? To take an example from the article: why does someone have a filename beginning with a dash? Maybe don't do that.

show 4 replies
Chinjuttoday at 5:20 AM

The "Everything is text, do everything via text" philosophy has its advantages, and also its disadvantages.

show 2 replies
epistasistoday at 4:53 AM

Perhaps I'm missing something (it's been a long day), but couldn't "--" be used for both?

    git cmd --options -- rev -- pathspec
would be the fully specified revspec and pathspec

    git cmd --option -- rev --
would be just the revspec, excluding accidental options, without a pathspec

    git cmd --option revspec -- pathspec
and the single "--" would work as it currently does.
show 2 replies
_blktoday at 4:35 AM

> git log --end-of-options "$rev" -- "$path",

Argh, that's when I wished for object oriented shells. Powershell sure isn't perfect but objects encoding their own meaning really helps differentiate those cases (but it may not always help the user if types aren't clear to the reader)

show 1 reply
ButlerianJihadtoday at 4:45 AM

https://m.xkcd.com/1597/

By the way, something munched the article title. An endash is incorrect command-line usage. It’s supposed to be a double hyphen.

show 3 replies
xyzsparetimexyztoday at 7:13 AM

What a mess. Just use jj instead.

luciana1utoday at 7:00 AM

[dead]

usr1106today at 5:46 AM

Copilot CLI (we get that at work) often uses slightly low-level and cryptic git commands. Never noticed that it would use --end-of-options though.

Should check what it does with branch names starting with a dash.

Of course that wouldn't be a security vulnerability, but a user error. It asks user approvals to execute those things and has disclaimers to check results. Which of course every user does all the time... /s

show 1 reply
sawrtagytoday at 8:26 AM

[dead]