简体   繁体   English

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

[英]Find long SHA from short SHA for git diff

I was generating difference / changes done in the commit so that I can upload it in ReviewBoard. 我在提交中生成差异/更改,以便我可以在ReviewBoard中上传它。

I used "git show d9f7121e8ebd4d1f789dab9f8214ada2h480b9cf". 我使用了“git show d9f7121e8ebd4d1f789dab9f8214ada2h480b9cf”。 It gave me diff something like... 它给了我差异......

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%;
 }

When I create .patch file of this diff. 当我创建这个差异的.patch文件时。 Reviewboard rejects it saying "'3cfa8e8' revision is not valid format. SHA1 is too short". Reviewboard拒绝它说“'3cfa8e8'修订版无效格式.SHA1太短”。

So I wanted to get long SHA1 from short SHA1 '3cfa8e8'. 所以我想从短SHA1'3cfa8e8'获得长SHA1。

I did 'git show 3cfa8e8'. 我做了'git show 3cfa8e8'。 It just shows me some content of file. 它只是向我展示了一些文件内容。 Doesn't show me anything else. 没有给我任何其他信息。

Any help how can I get long SHA? 任何帮助我如何获得长SHA?

(Note:- All the sha and file diff are example to demonstrate the problem) (注意: - 所有sha和文件差异都是示例来说明问题)

git rev-parse <short sha> should do the trick. git rev-parse <short sha>应该做的伎俩。

See also the git rev-parse manpage . 另请参阅git rev-parse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM