2013-11-26 71 views
2

我想爲Precommit審閱創建一個Crucible Review票據。創建Crucible Review Precommit

我現在面臨一個問題,像我無法找到新創建的文件中尚未COMMITED上GIT補丁。

+0

上傳的補丁文件是否包含新創建文件的差異? – sendmoreinfo

+0

不可以。我無法獲取補丁文件中新創建的文件。 –

回答

0

解決了這個,

由新創建的文件以「附件」選項安裝。

2

使用git add將所有文件添加到舞臺後,可以使用git diff --staged獲取修補程序中的所有更改的完整列表。

事情是這樣的:

$ git status 
# On branch master 
# Changes to be committed: 
# (use "git reset HEAD <file>..." to unstage) 
# 
# modified: file1 
# new file: file2 
# 
$ git diff --staged 
diff --git a/file1 b/file1 
index 5823f01..eb6be9e 100644 
--- a/file1 
+++ b/file1 
@@ -1,2 +1,3 @@ 
sometthing 
+line 2 

diff --git a/file2 b/file2 
new file mode 100644 
index 0000000..f138820 
--- /dev/null 
+++ b/file2 
@@ -0,0 +1 @@ 
+this is file2 

所以創建您的坩堝預提交評審,輸出重定向到一個文件,然後上傳補丁文件。

git diff --staged > patch.txt 
相關問題