git log: only show yesterday's commit
git, git-log
Solution
I was looking for a way to show all commits since "yesterday" and was having trouble to get the commits older than 24 hours ago (if it's 11am and I just use `--since=yesterday`, I wouldn't get commits made e.g. at 10:30am, as already pointed). Using
git log --since=yesterday.0:00am
or, more conveniently
git log --since=yesterday.midnight
solved it. Kudos to "tinifni" for his very useful gist: https://gist.github.com/tinifni/3756796
Problem
`git log --since=yesterday --until=today` doesn't work because it will include today's commits. `git log --since=yesterday --until=yesterday` doesn't work because it will not show anything at all. I'm assuming that "yesterday" translates to 12:01am of the previous date, and "today" translates to the current hour. That can make sense to some degree, but it is very unhelpful for me right now. I also want this to be in a script. So I can't hardcode the dates/times. Is the only option really to programmatically calculate yesterday's date and manually pass the hour as well? EDIT: I noticed the following. In the source code for the most recent version of git, it appears that "yesterday" (see code here) means 24*60*60 seconds before the current time. So depending on how precise you need to be, that could matter. Right above that line in the code you see that "today" does mean right now