在我的遠程存儲庫上創建了一個新的分支。在我的工作目錄(主分支)上的GitBash中,輸入git remote update
和git pull
。據我瞭解git remote update
將更新所有分支機構設置爲這裏解釋追蹤遠程的: What is the difference between 'git remote update', 'git fetch' and 'git pull'?git分支unkown,但結帳工作
所以,當我鍵入git diff master newBranch --name-only
我希望看到這是在兩個分支不同的文件列表。而是我得到了以下錯誤消息:
fatal: ambiguous argument 'newBranch': unknown revision or path not in the working tree.
但如果我鍵入git checkout newBranch
它工作正常,如果我通過鍵入git checkout master
突然git diff master newBranch --name-only
作品完美地切換回主?
任何人都可以向我解釋這種行爲嗎?