3 ms·
Why do they have '--' as an argument in a lot of the commands? I don't think that's necessary?
by candiddevmike 4y ago
Why do they have '--' as an argument in a lot of the commands? I don't think that's necessary?
- PeterWhittaker 4y agoTo quote TFM: > This option can be used to separate command-line options from the list of files, (useful when filenames might be mistaken for command-line options). This is a common idiom, e.g., to grep a file for a pattern that matches a grep argument, > grep -- -e file Edit: fixed dash weirdness.
- gizmo686 4y agoIt forces git to intereperet what comes after as paths. Normally this is not needed, but occasionally you get a filename that causes ambiguity. For instance, "git checkout test.c" will check out the file test.c unless you happen to have a branch called "test.c". (See also people complaining that checkout is overloaded". Simmilarly, "git add --verbose test.c" will add test.c, and log that to stdout. "git add -- --verbose test.c" will add test.c and --verbose, where "--verbose" is the name of a file. This isn't git specific, most CLI tools use "--" to restrict the parsing on arguements that follow.