Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
596 views
in Technique[技术] by (71.8m points)

git - How do I view all commits for a specific day?

I've already looked at the relevant docs from git-scm.com and gitref.org, but I can't seem to figure this out.

Let's say I want to get all commits for Tuesday, November 12th, 2013. Using an existing repo as an example, I know for a fact that I have commits on that day, as well as commits the day before and the day after.

With 2013-11-11 and 2013-11-12

All the following give me commits for both November 11th and 12th:

  • git log --after="2013-11-11" --until="2013-11-12"
  • git log --since="2013-11-11" --until="2013-11-12"
  • git log --after="2013-11-11" --before="2013-11-12"
  • git log --since="2013-11-11" --before="2013-11-12"

With 2013-11-12 only

All the following give me no commits:

  • git log --since="2013-11-12" --until="2013-11-12"
  • git log --since="2013-11-12" --before="2013-11-12"
  • git log --after="2013-11-12" --until="2013-11-12"
  • git log --after="2013-11-12" --before="2013-11-12"

With 2013-11-12 and 2013-11-13

As expected (from the results of 2013-11-11 and 2013-11-12 above), all of the following give me results from both November 12th and 13th:

  • git log --since="2013-11-12" --before="2013-11-13"
  • git log --after="2013-11-12" --before="2013-11-13"
  • git log --since="2013-11-12" --until="2013-11-13"
  • git log --after="2013-11-12" --before="2013-11-13"

...and so on and so forth. I feel like I've tried every possible combination of since, after, before, and until but still can't find the answer, nor do I understand whether those options are inclusive or exclusive, since they seem to be inclusive if the two dates are different, but exclusive if they're on the same day. Did I miss something / what am I doing wrong?!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Thanks John Bartholomew!

The answer is to specify the time, e.g. git log --after="2013-11-12 00:00" --before="2013-11-12 23:59"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...