Is it the "end of option" I am used to see in bash (and if yes, why do we use it) or is it a Git notation for the Index or the HEAD?
+7
A:
The --
separates the paths from the other options. From the documentation:
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
If this notation didn't exist the following two commands would be ambiguous:
git checkout <tree-ish> <path1> <path2>
git checkout <path1> <path2> <path3>
With the --
notation it is clear which is meant:
git checkout <tree-ish> -- <path1> <path2>
git checkout -- <path1> <path2> <path3>
The documentation I linked to above includes an example of when you might need it:
$ git checkout hello.c
If you have an unfortunate branch that is named hello.c, this step would be confused as an instruction to switch to that branch. You should instead write:
$ git checkout -- hello.c
Mark Byers
2010-03-27 22:50:31
Of course, if you have a path called `-f`, that raises other questions, like why you need a path called `-f`. :)
John Feminella
2010-03-27 22:52:57
@John Feminella: True, I found a hopefully better example.
Mark Byers
2010-03-27 22:55:04