leeand00
leeand00

Reputation: 26422

Does the `git checkout --` command have anything to do with the `--` argument of bash?

I was attempting to export a bash environment variable of a path with a dash in it when I came across the -- argument of bash. I noticed that it's seemly similar to how one checks out a single file of some version in in git.

Is there any relation between the two, are they the same thing, do they severe the same purpose?

Upvotes: 1

Views: 428

Answers (1)

chepner
chepner

Reputation: 532518

-- is not anything specific to bash; it is a convention that many commands follow when processing their arguments. The convention is that no argument appearing after -- should be treated as an option, even if there is an option by that name.

This convention is recommended as Guideline #10 in the POSIX Utility Syntax Guidelines.

Upvotes: 5

Related Questions