查找具有特定git note的提交 [英] Find commit with specific git note
本文介绍了查找具有特定git note的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在存储库中使用git note.有时,我需要查找包含给定字符串的带有注释的提交.到目前为止,我正在使用以下命令:
I use git notes in my repository. Sometimes I need to find a commit with note that includes given string. So far I was using this command:
git log --show-notes=* --grep="PATTERN" --format=format:%H
这里的问题是,即使不是仅在提交消息中的注释中,它也会打印每个带有PATTERN的提交SHA. 有更好的方法吗?
The problem here is that this prints every commit SHA with PATTERN, even if it's not in notes only in commit message. Is there a better way for that?
推荐答案
注释存储在COMMIT
ed TREE
中,该注释隐藏在注释ref(默认为refs/notes/commits
)旁边.这意味着您可以像处理内容一样处理它们.
Notes are stored in a COMMIT
ed TREE
that's "hidden" off to the side under a notes ref (refs/notes/commits
by default). That means you can process them just like content.
$ git grep Testing refs/notes/commits
refs/notes/commits:fad066950ba73c309e80451d0d0f706e45adf5a8:This is a test - Testing
$ git show fad0669
commit fad066950ba73c309e80451d0d0f706e45adf5a8
Author: Mark Adelsberger <adelsbergerm@xxx>
Date: Thu Sep 6 07:51:15 2018 -0500
1
Notes:
This is a test - Testing
diff --git a/file1 b/file1
index e69de29..038d718 100644
--- a/file1
+++ b/file1
@@ -0,0 +1 @@
+testing
这篇关于查找具有特定git note的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文