我在提交中生成差异/更改,以便我可以将其上传到 ReviewBoard。
我使用了“git show d9f7121e8ebd4d1f789dab9f8214ada2h480b9cf”。它给了我 diff 之类的东西......
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 和文件差异都是演示问题的示例)
最佳答案
git rev-parse <short sha>
应该可以解决问题。
关于git - 从 git diff 的短 SHA 中查找长 SHA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19021671/