简体   繁体   English

git rev-list的语法是什么?

[英]What is this git rev-list syntax?

git rev-list --max-count=1 --reverse ':/[git-p4:.*change = 68846]'

While running git-p4, I received this error message right at the end (rats!): 运行git-p4时,我在最后收到了此错误消息(警告!):

Importing revision 70169 (100%)fatal: ambiguous argument ':/\[git-p4:.*change = 68846\]':  unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
Command failed: ['git', 'rev-list', '--max-count=1', '--reverse', ':/\\[git-p4:.*change = 68846\\]']

The last argument to rev-list should be a commit. rev-list的最后一个参数应该是提交。 I've not seen commit specified quite like this before. 我以前从未见过像这样指定提交。

What am I looking at here? 我在这里看什么 What is git-p4 trying to do? git-p4打算做什么?

Answering my own question: 回答我自己的问题:

from gitrevisions 来自gitrevisions

:/, eg :/fix nasty bug :/,例如:/ fix讨厌的错误

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. 此名称返回可从任何引用访问的最年轻的匹配提交。 If the commit message starts with a ! 如果提交消息以!开头 you have to repeat that; 你必须重复一遍; the special sequence :/!, followed by something else than !, is reserved for now. 现在保留特殊顺序:/ !,后跟除!之外的其他内容。 The regular expression can match any part of the commit message. 正则表达式可以匹配提交消息的任何部分。 To match messages starting with a string, one can use eg :/^foo. 为了匹配以字符串开头的消息,可以使用例如:/ ^ foo。

Although my translation is a bit off. 虽然我的翻译有点过头了。 It needs to escape the []. 它需要转义[]。

git rev-list --max-count=1 --reverse ':/\\[git-p4:.*change = 68846\\]'

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

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