Git日志输出在特定的版本范围内 [英] Git log outputs in a specific revision range

查看:655
本文介绍了Git日志输出在特定的版本范围内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题。我怎么能得到2修订版号之间的所有日志消息为特定的路径?让我通过例子来解释。



我试图用下面的代码写下它:

  git -dir = / home / Desktop / GIT_REFERENCE_REPOSITORIES / manager.git log 10000 ... 15000 

我以为它给了我与manager.git相关的日志消息,介于10000到15000个修订版本之间。但事实并非如此。有人帮我吗?

解决方案

修改由其SHA1哈希指定。你希望看到具体文件的提交,你必须用 - 来分隔路径:

  git log oldhash..newhash  -  path / to / inspect 

可以做到这一点。

另外请注意,您使用三个点( ... )来指定范围。 通常情况下,您只需要两个点



三个点可能不会达到您所期望的结果。正如 gitrevisions手册页指定范围)表示,而

  git log a..b 

表示给我所有自 a 之后的提交,直到包括 b (或者像手册页所示的那样包含可从b访问的提交但排除可从a访问的提交),三点变体

  git log a ... b 

的意思是包含可从a或b中获得的提交,但排除可从两个提供的提交,这是完全不同的事情。


Here is my problem. How could I get all log messages between 2 revision numbers for a specific path ? let me explain via example.

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 ?

解决方案

A revision is specified by its SHA1 hash.

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

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

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.

这篇关于Git日志输出在特定的版本范围内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆