pre-commit - 创建 Crucible Review 预提交

标签 pre-commit atlassian-crucible

我想创建一张 Crucible Review 票证以进行预提交审核。

我面临一个问题,比如我无法在尚未提交到 GIT 的补丁中找到新创建的文件。

最佳答案

使用 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

因此,要创建 Crucible 预提交审核,请将输出重定向到文件,然后上传补丁文件。

git diff --staged > patch.txt

关于pre-commit - 创建 Crucible Review 预提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20216872/

相关文章:

svn - 在 svn 和 git 中提交时如何添加命令行提示符作为 $EDITOR

GIT Pre-Commit Hook 更改文件但不添加提交

svn - 如何将修订添加到未编入索引的 Crucible 中的评论

kotlin - Kotlin 的 Fisheye/Crucible 语法高亮

svn - 如何将分支与它在 Crucible 中开始的主干修订版进行比较?

java - 坩埚 REST API : Can't add reviewer

android - Sherter Gradle插件,可进行预提交

git - 在 Git 中提交之前临时清除未跟踪的文件

eslint - 如何使用 Husky 版本 6 进行 lint-staged 工作