gpt4 book ai didi

git - "whose commit message matches the given regular expression"是否符合 "the youngest commit"或 `rev` 的条件?

转载 作者:太空狗 更新时间:2023-10-29 14:41:30 24 4
gpt4 key购买 nike

Git 袖珍指南说

rev^regexp

For example, HEAD^{/"fixed pr#1234"}; this selects the youngest commit reachable from rev whose commit message matches the given regular expression.

“其提交消息与给定的正则表达式匹配”是否符合“最年轻的提交”或 rev 的条件?

我总是不确定这个和类似的案例。

最佳答案

rev做。来自 gitrevisions ...

<rev>^{/<text>}, e.g. HEAD^{/fix nasty bug}

A suffix ^ to a revision parameter, followed by a brace pair that contains a text led by a slash, is the same as the :/fix nasty bug syntax below except that it returns the youngest matching commit which is reachable from the <rev> before ^.

请注意,它不是整个存储库中最年轻的提交。它是 可从 <rev> 到达的最年轻的提交。如果你想要整个 repo 中最年轻的使用 :/<regexp> .

:/<text>, e.g. :/fix nasty bug

A colon, followed by a slash, followed by a text, names a commit whose commit message matches the specified regular expression. This name returns the youngest matching commit which is reachable from any ref, including HEAD. The regular expression can match any part of the commit message. To match messages starting with a string, one can use e.g. :/^foo. The special sequence :/! is reserved for modifiers to what is matched. :/!-foo performs a negative match, while :/!!foo matches a literal ! character, followed by foo. Any other sequence beginning with :/! is reserved for now. Depending on the given text, the shell's word splitting rules might require additional quoting.

如果您意识到 Git 的历史不像一大堆煎饼,这就更有意义了。这是一个directed graph . Git 历史看起来像这样......

------ time -------->

[HEAD]
A <- B <- C <- D [master]
^
\
E <- F <- G [feature]

这显示了带有 master 的存储库分支 checkout 。它还有一个 feature提交时间小于 master 的分支. G 是存储库中最年轻的提交,但 D 是 master 可达的最年轻提交和 HEAD .

HEAD^{/fix nasty bug}将搜索 fix nasty bug在 D 中,然后是 C,然后是 B,然后是 A。因为连接是单向的,所以它不会搜索 E、F 或 G,因为它们无法从 HEAD 到达。 .

关于git - "whose commit message matches the given regular expression"是否符合 "the youngest commit"或 `rev` 的条件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54245665/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com