Value - in git checkout

If I want to replace the folder on the working branch with the same folder from another branch, I can call:

git checkout OTHER_BRANCH -- /path/to/folder 

What does the meaning mean -?

+4
source share
1 answer

All after -- considered the file name. This is useful in at least two cases:

  • one name for the file and branch. Note the difference between git checkout foo -- and git checkout -- foo
  • file names that can be interpreted as a flag: git checkout -- -f (alternatively: git checkout ./-f
+8
source

Source: https://habr.com/ru/post/1387405/


All Articles