从短SHA中找到用于git diff的长SHA

时间:2013-09-26 07:12:13

标签: git diff sha review-board

我在提交中生成差异/更改,以便我可以在ReviewBoard中上传。

我使用了“git show d9f7121e8ebd4d1f789dab9f8214ada2h480b9cf”。它给了我一些类似......的差异。

diff --git a/src/index.php b/src/index.php
index 3cfa8e8..7f8440d 100644
--- a/src/index.php
+++ b/src/index.php
@@ -12,10 +12,13 @@
 .test {
     .input;
     width: auto;
+    border-width: 5px;
+    border-radius: 50%;
 }

当我创建这个差异的.patch文件时。 Reviewboard拒绝它说''3cfa8e8'修订版无效格式.SHA1太短了。“

所以我想从短SHA1'3cfa8e8'获得长SHA1。

我做了'git show 3cfa8e8'。它只是向我展示了一些文件内容。不向我展示任何其他内容。

任何帮助我如何获得长SHA?

(注意: - 所有sha和文件差异都是示例来说明问题)

1 个答案:

答案 0 :(得分:8)

git rev-parse <short sha>应该可以解决问题。

另请参阅git rev-parse manpage

相关问题