2016-03-06 13 views
4

這是我在嘗試比較分支和主之間的文件時:不能git diff。文件存在於兩個分支中,但在磁盤上存在「致命的:路徑'...',但不存在於'主'中」?

git diff gamemodes/terrortown/entities/entities/ttt_c4/shared.lua 
     master:gamemodes/terrortown/entities/entities/ttt_c4/shared.lua 

fatal: Path 'gamemodes/terrortown/entities/entities/ttt_c4/shared.lua' 
     exists on disk, but not in 'master'. 

這裏是主文件:

$ git log -n 1 -- gamemodes/terrortown/entities/entities/ttt_c4/shared.lua 
commit d0241471298ce617b68dcf268be1c0af0cf8170c 
Author: me 
Date: Fri Jan 1 23:25:17 2016 -0600 

    December 2015 Update 

這裏是我的分支real_disarm文件:

$ git log -n 1 -- gamemodes/terrortown/entities/entities/ttt_c4/shared.lua 
commit 84a7de46b92b8747cf98a57a8f7101682377980e 
Author: me 
Date: Sun Jan 10 00:27:33 2016 -0600 

    Remove trailing whitespace 

顯然這個文件存在於兩個分支中。我比較這些文件的全部原因是因爲我試圖刪除末尾的空格,以便我的修補程序不給煩人的「警告:壓制5空格錯誤警告:10行添加空格錯誤。輸出。

+1

'git diff ..master - gamemodes/terrortown/entities/entities/ttt_c4/shared.lua'有同樣的問題嗎? – VonC

+0

我以前從未見過使用'diff'命令的這種方式。 [我也無法看到它](https://git-scm.com/docs/git-diff)。 –

+0

@MarekR [This](http://stackoverflow.com/a/9113407)是我從中獲得比較功能的地方。 – PatPeter

回答

相關問題