這個git命令中的文件名之前的雙破折號是什麼意思?Git結帳雙破折號的含義
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
它們是強制性的嗎?它是相當於
git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
這個git命令中的文件名之前的雙破折號是什麼意思?Git結帳雙破折號的含義
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
它們是強制性的嗎?它是相當於
git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
假設我有一個名爲我的Git倉庫path/to/file.txt
文件,我想恢復它的變化。
git checkout path/to/file.txt
現在假設文件被命名爲master
...
git checkout master
哎呦!相反,這改變了分支。 --
將要檢出的樹與要檢出的文件分開。
git checkout -- master
它也幫助我們,如果一些freako添加了一個名爲-f
我們的庫文件:
git checkout -f # wrong
git checkout -- -f # right
雙破折號「 - 」的意思是「命令行標誌的結束」,即它告訴前面的命令不要試圖解析命令行選項後面的內容。
這是一個shell表達式。請參閱http://unix.stackexchange.com/questions/11376/what-does-double-dash-mean – iltempo
@iltempo:Git略有不同。對於Git,在樹和路徑看起來相同的情況下,它將樹與路徑分開。 –
@Dietrich_Epp。我懂了。感謝澄清。 – iltempo