3

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?

Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254

1 Answers1

2

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)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250