从远程获取上个月在git分支上提交的文件列表 [英] Get list of files committed on git branch in last month from remote

查看:130
本文介绍了从远程获取上个月在git分支上提交的文件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取所有在上个月为master分支在github repo上更改的文件列表。

  git diff --stat @ {1.month.ago} 

...我收到一条警告消息,变化。我也试过:

  git diff --stat @ {1.month.ago} origin 
git diff - stat @ {1.month.ago} origin / master
git diff --stat @ {1.month.ago} origin master

...具有相同的结果。



如何从命令行收集此列表? $ b

解决方案

获得不依赖于reflog的差异的唯一方法是在正确的提交之间做差异。



正如中所解释的那样,如何获得两个日期之间发生的所有提交与Git之间的差异?,在你的情况下,正确的提交是(使用 <$ c git rev-list ):

  git rev-list -n1 --first-parent --until =<日期字符串> < a ref> 
git rev-list -n1 --first-parent --until =1个月前HEAD

即:第一次提交是一个月的时间。

然后差异是:

pre> git diff --stat $(git rev-list -n1 --first-parent --until =1.month.agoHEAD)


I'm trying to get a list of all files that have changed on a github repo in the last month for the master branch. My local clone does not have logs going back that far, so when I run the following command:

git diff --stat @{1.month.ago}

...I get a warning message, and a fraction of the changes. I also tried:

git diff --stat @{1.month.ago} origin
git diff --stat @{1.month.ago} origin/master
git diff --stat @{1.month.ago} origin master

...with the same result.

How to collect this list from the command line?

解决方案

The only way to get a diff which does not depends on reflog is to do a diff between the right commit(s).

As explained in "How can I get the diff between all the commits that occurred between two dates with Git?", in your case, the right commit is (using git rev-list):

git rev-list -n1 --first-parent --until=<a date string> <a ref>
git rev-list -n1 --first-parent --until="1 month ago" HEAD

That is: the first commit which was one month old.

Then a diff would be:

git diff --stat $(git rev-list -n1 --first-parent --until="1.month.ago" HEAD)

这篇关于从远程获取上个月在git分支上提交的文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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