特定修订范围内的 Git 日志输出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18595305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git log outputs in a specific revision range
提问by caesar
Here is my problem. How could I get all log messages between 2 revision numbers for a specific path ? let me explain via example.
这是我的问题。如何获取特定路径的 2 个修订号之间的所有日志消息?让我通过例子来解释。
I tried to write it with this line :
我试着用这一行来写:
git -dir=/home/Desktop/GIT_REFERENCE_REPOSITORIES/manager.git log 10000...15000
I assumed it gives me the log messages related to manager.git between 10000 and 15000 revisions. But it doesn't. Is there anyone to help me ?
我认为它为我提供了与 manager.git 相关的 10000 到 15000 次修订的日志消息。但事实并非如此。有没有人可以帮助我?
回答by eckes
A revision is specified by its SHA1 hash.
修订版由其 SHA1 哈希值指定。
If you want to see commits for specific files, you have to separate paths with --
:
如果要查看特定文件的提交,则必须使用以下命令分隔路径--
:
git log oldhash..newhash -- path/to/inspect
does this.
做这个。
Also note that you are using three dots (...
) to specify the range. Usually, you only want two dots.
另请注意,您使用三个点 ( ...
) 来指定范围。通常,您只需要两个点。
Three dots might not give the result you'd expect. As the man page for gitrevisions(section SPECIFYING RANGES) says, while
三个点可能不会给出您期望的结果。正如gitrevisions的手册页(部分SPECIFYING RANGES)所说,而
git log a..b
means give me all commits that were made since a
, until and including b
(or, like the man page puts it "Include commits that are reachable from b but exclude those that are reachable from a"), the three-dot variant
意味着给我所有的提交,这些提交是从a
,直到和包括b
(或者,就像手册页所说的那样“包括从 b 可以访问的提交,但排除那些可以从 a 访问的提交”),三点变体
git log a...b
means "Include commits that are reachable from either a or b but exclude those that are reachable from both", which is a totally different thing.
意味着“包括可从 a 或 b 访问的提交,但排除可从两者访问的提交”,这是完全不同的事情。