What does the double-dash [--] option do on git reset?

前端 未结 2 1590
故里飘歌
故里飘歌 2021-02-07 16:28

I\'ve seen commands like:

git reset e542 -- readme.txt

I understand this command puts in the index the contents of the file readme.txt from com

2条回答
  •  时光说笑
    2021-02-07 16:30

    -- separates branch names from file names, in case there is any ambiguity (if you have a branch and a file with the same name). If there are no ambiguities, you don't need the --.

    Also as mentioned by Jonas Wielicki, this allows for file names that start with a -; these would otherwise be interpreted as command-line options.

提交回复
热议问题