60

How can i get a list of all the git commits done to the master branch between 2014-01-01 and 2014-06-30?

I know git log will give me roughly this format (repeated for all commits):

commit <hash>
author: <author name>
date: <date>
<comment>

But how can it be limited to selected dates and a one line per commit format?

<hash> <author> <date>
<hash> <author> <date>
1

4 Answers 4

88
$ git log --since "DEC 1 2014" --until "DEC 5 2014" --pretty=format:"%h %an %ad"

This will give the format you want for the commits between dec 1 2014 and dec 5 2014, you can change the dates as you like

If you wish to change the format, you can read about the options here

1
  • add this at the end to write the output to a file> output
    – emrcftci
    Dec 28, 2021 at 17:45
25
$ git log master --pretty="%h %an %ad" --since=2014-01-01 --until=2014-06-30

Here is everything http://git-scm.com/docs/git-log

2
  • ty. one point, cos you included branch, and prefered date format Dec 5, 2014 at 10:36
  • This is perfect because my script already uses this date format Oct 17, 2020 at 5:46
6

Have you tried

git whatchanged --since="2 year ago" --until="1 year ago" [--author="NAME_OF_THE_AUTHOR"]

Even git log can be utilized to have this result. There are some advance options available in git log

git log --after="2014-7-1" --before="2014-7-4"

For more details about advance git log you can refer to this link

5

Well, this should do the trick:

git log --oneline --since="1/1/2014" --until="30/6/2014"

3
  • 2
    This is not the requested format, though. Just hash and commit message
    – Tim
    Dec 5, 2014 at 10:16
  • 1
    @TimCastelijns yup, im aware of that, but before i managed to fix it you posted your answer and i was too busy upvoting it to fix mine ;)
    – 4rlekin
    Dec 5, 2014 at 10:18
  • @4rlekin Please change since to --since.
    – Christian
    Feb 5, 2020 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.