Find date for not dated commit?

I’m doing a git log to list all commits and then parse them.
With this command:

git log --encoding=UTF-8 --date=local --pretty=format:'%H,%P,%at,%ct,%an,%s'

In some weird repos i get commits without the date in both author and commit dates.
I tried with the simple:

git log

and what i got was a 1970 date.

A repo where this happens is SamWM/jQuery-Plugins, for example in the commit e9dddaf24c9de45d9b4efdf38eff7c30eb200f48.

Although in GitHub we have and interesting date when we go look for it.

Can anybody help me get an interesting date for this commit that should be somewhere in the middle of the other ones?

  • Emacs mode or validation tool to help detect errors in JSON files?
  • How do I associate changed lines with functions in a git repository of C code?
  • Add a Git alias containing a semicolon
  • Parse the git index file and save to text file
  • Finding the modules where changes were checked with svn
  • Parse color from git log
  • YAML parser from bash
  • What's the proper way to determine the status of a Git branch programmatically?
  • One Solution collect form web for “Find date for not dated commit?”

    git show --format=raw shows:

    commit e9dddaf24c9de45d9b4efdf38eff7c30eb200f48
    tree d63aeb159635cb231e191505a95a129a3b4a7b38
    parent 9276202f1c0dcc360433df222c90f7874558f072
    author SamWM <> 1288370243 --700
    committer SamWM <> 1288370243 --700

    The timezone information here is invalid, and I’m not sure how he author managed to create this. Other commits do use the correct -0700 format.

    You can convert this using GNU date, with the knowledge that --700 is supposed to be -0700:

    $ TZ=Etc/GMT+7 date -d @1288370243
    Fri 29 Oct 09:37:23 GMT+7 2010

    so the correct answer in Git’s usual format is Fri 29 Oct 09:37:23 2010 -0700.

    Note: I’m using TZ=Etc/GMT+7, not GMT-7. You can see by running the same command with different commits that do have correct time zone information that the result is exactly what it’s supposed to be. date‘s time zone conversion is exactly the wrong way around for what’s needed here, and by negating the offset I’m cancelling out the error.

    You can, in a local copy, fix such commits using git hash-object and git replace. First, a sanity check that my commands are in order:

    $ git cat-file commit e9dddaf24c9de45d9b4efdf38eff7c30eb200f48 |
    > git hash-object -t commit -w --stdin

    This command loaded the specified commit, wrote it back unmodified, and showed the rewritten commit’s hash. I’m using this as a sanity check: if I got a different hash, something would have to be wrong in my command.

    Now, it’s possible to insert something to create a fixed commit:

    $ git cat-file commit e9dddaf24c9de45d9b4efdf38eff7c30eb200f48 |
    > sed -e 's/--700/-0700/' |
    > git hash-object -t commit -w --stdin

    and use that fixed commit instead:

    $ git replace e9dddaf24c9de45d9b4efdf38eff7c30eb200f48 46694249ed3d519b0c934222520b9dc6d8557fa1

    After that, all references to e9dddaf24c9de45d9b4efdf38eff7c30eb200f48 will look at 46694249ed3d519b0c934222520b9dc6d8557fa1 instead, and git show e9dddaf24c9de45d9b4efdf38eff7c30eb200f48 now starts with:

    commit e9dddaf24c9de45d9b4efdf38eff7c30eb200f48
    Author: SamWM <>
    Date:   Fri Oct 29 09:37:23 2010 -0700
        Update version number, make text formatting and indentation consistent with the rest of the code
    Git Baby is a git and github fan, let's start git clone.