Many of my older notes do not have a creation or modification time in the YAML. I want a quick way to get the first time a file was added and the last time it was modified, and I found the following command:

shingara @ stackoverflow.com

git log --follow --format=%ad --date default FILE | tail -1

This gives the time the file was added, but I actually also want the last time the file was modified. Thankfully, we can replace tail -1 with something appropriate for our use case:

git log --follow --format=%ad --date iso-strict FILE | sed -n '1p; $p'

Unfortunately, I quickly found out this isn’t actually what I want since I didn’t want to consider link URL changes and YAML frontmatter changes as a modification. So, I had to browse all the diffs manually for each file:

git log -p --stat --follow --date iso-strict FILE