7

I'm currently learning Git by following the book "Pro Git".

In the book, when discussing different options for git log --since=<date>, the author said some of the potential options for the <date> are

git log --since=2.weeks
git log --since="2008-01-15"
git log --since="2 years 1 day 3 minutes"

I was wondering, where can I find a complete list of what I can use as a date format in the --since=<date> option?

I have looked at the git log manpage on git-scm.com as well as searched the git-scm.com but I can't find it.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Thor
  • 9,638
  • 15
  • 62
  • 137
  • 1
    Check out `man git log` on command line. It gives you every option you could possibly want, with descriptions. – jhpratt Jul 31 '17 at 00:05
  • 3
    People, you are not answering the question! The man page does NOT have this information ... and surprisingly, neither does `git rev-parse`, which is what is used underneath. – o11c Jul 31 '17 at 00:09
  • @o11c I'm looking for options that specify what kind of date format I can use e.g. I can use "2.weeks", but what else is available? Like you said, the `git log` manpage does not seem to have this information, so i was wondering where exact could I find it? – Thor Jul 31 '17 at 00:17
  • 1
    @CaptainAmerica That's quite different from how I read the origin question. – jhpratt Jul 31 '17 at 00:24
  • 1
    try using git GUI like source tree and git extension you can manage your git more efficient. https://www.sourcetreeapp.com/ https://sourceforge.net/projects/gitextensions/ – Rai Jul 31 '17 at 00:27
  • @jhpratt I'm very sorry that I didn't make my intend clear initially, I think the edit by Nick explained better than I did. Sorry – Thor Jul 31 '17 at 00:29
  • 1
    @CaptainAmerica The edit definitely makes it clearer. My new answer is what you're looking for (I hope!) – jhpratt Jul 31 '17 at 00:30
  • 2
    As far as I can tell, there is *no* actual documentation for this. In case the documentation ever gets outdated, the (scary) source code is https://github.com/git/git/blob/master/date.c – o11c Jul 31 '17 at 00:31
  • @jhpratt except that you're not supposed to actually answer when it's an exact duplicate, which this turns out to be – o11c Jul 31 '17 at 00:32
  • @o11c I guess its unfortunate that there is no documentation available. And Thanks for the source code link, I guess i will go through it when I'm brave enough lol – Thor Jul 31 '17 at 00:34
  • 1
    @CaptainAmerica even if you don't understand the *code*, you can try just looking at the string literals, then shoving them together to see if it works. – o11c Jul 31 '17 at 00:45

1 Answers1

3

Check out this answer.

It goes into good detail about the current and historical options. Particularly, formats can follow RFC2822, ISO8601, or have relative formats, which is what you had in your question.

jhpratt
  • 6,841
  • 16
  • 40
  • 50