简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM