Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What does -- do exactly?


-- in git is usually used to mark the end of options. After --. --foo means an argument --foo, not the option --foo.

Git checkout and a few other commands also use it to separate branch and the rest of paths, because you could specify like this

    git checkout branch path1 path2
    git checkout path1 path2
    git checkout branch # what if there's a file named "branch"?
-- help disambiguates that by being between the branch and the paths, so

    git checkout branch -- # always checkout a branch
    git checkout -- path1 path2 # always checkout paths
    git checkout branch -- path1 path2 # same, but disable disambiguation logic


it is used for that purpose in many other tools as well (grep, for example)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: