Git Command to fetch creation-date-time of all files in git folder at once

148 Views Asked by At

I want to fetch (at once) the creation-date-time of all the files present in a particular folder in GIT

Please let me know the git command for the same.

I found a Git command for fetching the creation-date-time of a single file:

git log --diff-filter=A --follow --format=%aD -- filename.py | tail -1

but this command is not useful if I want to fetch at once all the file's creation-date-time of a particular folder in GIT.

Also how to call this git command from a python script?

1

There are 1 best solutions below

0
Matth B On

If you can use bash, you could use a 'for' loop:

for file in *; do ...$file... ;done

using your command:

for file in *; do git log --diff-filter=A --follow --format=%aD -- $file | tail -1;done

Including name for readability:
for file in *; do echo "$file creation date :"; git log --diff-filter=A --follow --format=%aD -- $file | tail -1;done