Hacker News new | ask | show | jobs
by gizmo686 1410 days ago
I don't know what it is called, but it forces what comes after to be interpreted as a filepath.

This is not git specific, but a common convention for CLI tools. Try running:

    > touch -- -i foo
    > rm -- -i foo
And compare what happens without the "--".
3 comments

And then we have startx, which starts both an X server and the X client specified:

  startx /path/to/client --with --client-options and arguments -- --server-options -go --here
Here, the double dash is used to separate the client options from the server options (the path to the server binary is compiled-in, IIRC).
Not only a filepath, this means pass anything past “—-“ ‘as is’ as an input and not an option flag.

docker run -it nginx —- ls la

Ah yes I've seen it in those kind of contexts too. Thanks everyone this has really clicked in to place for me :)
ObAgainstTheGuidelines: Me too.
Not a file path specifically and not an input exactly but I think the proper word would be an argument.
Thank you for this brilliant explanation (complete with interactive example :) I completely get it now.