How can I see the date multiple files were created on git?

I want to see the date of git creation (date of first commit where they were added) of all the files on a specified directory.


I'll break my solution into steps.

Get a list of all files in the repository
$ git ls-files

This returns a list of relative paths of all files in the repository.

Get the SHA-1 of the first commit of a given file:
$ git rev-list HEAD <file> | tail -n 1

This will return a list of all parentless commits for a given file, in reverse chronological order. The last one is the SHA-1 hash of the first commit for the given file.

You can verify this by running git log --raw <hash>. You should see something like:

commit <commit_hash>
Author: Susy Q <>
Date:   Wed Aug 24 12:36:34 2011 -0400

    Add new module ''

:000000 100644 0000000... <hash>... A
Show the date of a given commit
$ git show -s --format="%ci" <hash>
Bringing it all together in a bash script:
for file in $(git ls-files)
    HASH=$(git rev-list HEAD "$file" | tail -n 1)
    DATE=$(git show -s --format="%ci" $HASH --)
    printf "%-35s %s\n  %s\n" "$file" $HASH: "$DATE"

Well, i devised a solution which is not elegant but sort of works:

for file in dir/*; do echo -e "$file: \t\t `git log $file|grep Date|tail -1`"; done

it works by running git log on each file and then greping it to get only the dates of each commit regarding that file. Then tail -1 ensures that i will only get the date of the first commit. The echo -e "..." is there just so that it prints the info in a (not-so)friendly way!

Need Your Help

Laravel 5 mobile app login via token authentication

laravel-5 access-token

Is there any library or tutorial on token authentication compatible for Laravel 5? I'm working on a client mobile application and as far as I know, login is usually made via token auth, but surpris...