-1

On a git project, I would like to get the list of all commits that have been made after 6pm for a given user. Every day, since the creation of the project, must be taken into account in the research. Thanks in advance.

Ngb01
  • 3
  • 1

3 Answers3

0

To get the list of all commits made after 6PM local time on April 10th, 2020:
git log --date=local --after="2020-04-10T18:00:00"

fxdeaway
  • 165
  • 8
0

Other answers will work if you want to see commits after a given date and time. If you want to see all commits made after 6pm everyday, you could use something like this:

git log --pretty="format:%H %ad %an" --date iso | awk "/(18|19|20|21|22|23):[[:digit:]][[:digit:]]:[[:digit:]][[:digit:]]/ {print}"

To further filter by username you can just slap a grep on the end like ... | grep myusername

Evan Ogra
  • 206
  • 3
  • 11
  • Thanks for your reply. I think it's a good idea, but the awk command doesn't seem to work : hours are not filtered. – Ngb01 Apr 11 '20 at 05:26
  • @Ngb01Try it again, I found out `awk` prefers `[[:digit:]]` over `\d` – Evan Ogra Apr 11 '20 at 06:22
  • Thanks again for your reply, but not work again. I give you some data, maybe can help. Sorry for indent. `78e5111454545465 2020-04-05 19:05:02 +0200 Paul \n 78e5111454545465 2020-04-05 18:48:01 +0200 Paul \n 78e5111454545465 2020-04-04 21:57:05 +0200 Paul \n 78e5111454545465 2020-03-29 13:19:13 +0200 Paul \n 78e5111454545465 2020-03-28 13:41:37 +0100 Paul \n 78e5111454545465 2020-03-22 21:08:19 +0100 Paul \n 78e5111454545465 2020-03-22 13:51:39 +0100 Paul \n 78e5111454545465 2020-03-21 08:57:49 +0100 Paul \n 78e5111454545465 2020-03-21 08:27:36 +0100 Paul` – Ngb01 Apr 11 '20 at 07:10
0

You can write something like this:

git log --author=gitster --format="%H %aI" | grep -E 'T(1[89]|2)' | cut -d' ' -f1

This requires a relatively recent Git version for the %aI format, which is the author time; if you want the committer time, use %cI. You can use both if you want either one. And, of course, you'll want to change the author to something else.

bk2204
  • 64,793
  • 6
  • 84
  • 100