How to view all the fixes for a certain day?

I have already looked through the relevant docs of git-scm.com and gitref.org , but I cannot figure it out.

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

From 2013-11-11 and 2013-11-12

All the following give me fixes for 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"

Only 2013-11-12

All the following do not give me any 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"

From 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 the results from November 12 to 13:

  • 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"

... etc. etc. I feel like I have tried all possible combinations since , after , before and until , but I still can’t find the answer, and I don’t understand if these options are inclusive or exclusive, because they seem to be inclusive if the two dates are different, but are exceptional if they are on the same day. Am I missing something / what am I doing wrong ?!

+83
git git-log
Nov 14 '13 at 19:55
source share
4 answers

Thank John Bartholomew!

The answer is to indicate the time, for example. git log --after="2013-11-12 00:00" --before="2013-11-12 23:59"

+106
Nov 14 '13 at 20:07
source share

I usually check my git log and see that I was working on a specific day and update my schedule based on it, but it’s a pain in the ass to enter the full date in ISO format, so I just do it like this

 git log --after=jun9 --before=jun10 

and I add --author only to print my commits

 git log --since=jun9 --until=jun10 --author=Robert 

This imprint does what happened on June 9th (so in 2016 in this case, and not for 2015 or 2014, etc.).

The --since/--after and --until/--before can also accept things like 3 days ago , yesterday , etc.

+11
Jun 14 '16 at 7:31
source share

There is nothing wrong with the accepted answer (which I did not support), but ... we are here for science!

The output below can be expanded / customized using pretty=format:<string> placeholders :

 git log --pretty='format:%H %an %ae %ai' | grep 2013-11-12 

Not 100% error resistant, as the same line could be entered by the user. But acceptable depending on which placeholders are used. The above snippet, for example, will not fail.

You can simply analyze all git log before JSON and use / process your data in one hearty content. Check out https://github.com/dreamyguy/gitlogg and never look back!

Disclaimer: This is one of my projects.

+6
May 21 '16 at 23:35
source share

I made an alias for this specific purpose:

 commitsAtDate = "!f() { git log --pretty='format:%C(yellow)%h %G? %ad%Cred%d %Creset%s%C(cyan) [%cn]' --decorate --after=\"$1 0:00\" --before=\"$1 23:59\" --author \"`git config user.name`\"; }; f" 

Using:

 git commitsAtDate 2017-08-18 
+2
Aug 18 '17 at 12:57 on
source share



All Articles