2016-11-16 73 views
0

我有文件列表,我想获取每个文件在特定时间范围或使用标记提交的列表。如何使用标签获取文件的提交列表?

+0

“时间范围”可能有问题,因为,例如,开发人员在一个月前做了更改,但他今天将其推送到中央存储库。哪个“时间”与你有关?关于标签 - 这只是指向特定提交的指针。您想要获得哪些提交列表(与标记有关)? – Ivan

+0

查看[git help rev-list](https://git-scm.com/docs/git-rev-list),特别是'--since'和'--until'选项,以及''和''的论点。 – tom

回答

0
git log <commit-range specification> -- path/to/file1 ... path/to/fileN 

提交范围规范可能相当复杂。我建议阅读man git-log。如果你只需要提交列表(sha1和主题),你可能会发现有用的--pretty=oneline选项的git日志。从联机帮助的git-log

OPTIONS 
    <since>..<until> 
     Show only commits between the named two commits. When either <since> 
     or <until> is omitted, it defaults to HEAD, i.e. the tip of the 
     current branch. For a more complete list of ways to spell <since> 
     and <until>, see gitrevisions(7). 

0

引用下面的命令将显示从2016年11月16日10:00登录的path/to/file1至2016年11月16日12:00

git log $(git rev-list -n 1 --until="2016-11-16 10:00")..$(git rev-list -n 1 --until="2016-11-16 12:00") -- path/to/file1 

你需要添加一些程序来检查那些时间框架中是否有提交。

相关问题