2015-11-19 84 views
0

我試圖解析命令git status --porcelain的輸出。 正如SO answer所述。Git瓷器選項沒有顯示任何東西?

的問題是,在CLI中測試這個時候我沒有得到任何輸出:

git status 

output: 
On branch master 
Your branch is ahead of 'origin/master' by 1 commit. 
    (use "git push" to publish your local commits) 
nothing to commit, working directory clean 

而且隨着--porcelain

git status --porcelain 

output: 
(nothing :) 

有人能請解釋一下這是怎麼回事?

回答

1

git status --porcelain只顯示機器可讀格式的文件狀態。 - 檢查退出代碼以確保沒有發生錯誤(!= 0表示錯誤)。

由於「沒有提交,工作目錄清理」顯示爲git status,您將得到一個空文件列表。 - 更改一些文件或進行一些更改,你會看到一些輸出。

1

如果您沒有未追蹤的文件並且沒有更改的文件git status --porcelain不應該輸出任何內容,請嘗試添加文件touch new.file或更改現有的文件並重試。