我想为 Precommit 审核创建一张 Crucible Review 票证。
我面临一个问题,例如我无法在尚未在 GIT 上提交的补丁中找到新创建的文件。
我想为 Precommit 审核创建一张 Crucible Review 票证。
我面临一个问题,例如我无法在尚未在 GIT 上提交的补丁中找到新创建的文件。
将所有文件添加到 stage usinggit 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
因此,要创建您的 Crucible 预提交审查,请将输出重定向到文件,然后上传补丁文件。
git diff --staged > patch.txt
解决了这个,
通过使用“附件”选项附加新创建的文件。