To retrieve a list of dates on which a file has been committed to git, use git log
with a specific format that outputs the committer date only. For example, %cs
outputs the committer date in short format (YYYY-MM-DD
). See pretty-formats for more options.
git log --pretty='format:%cs' <filename> | tail -1
git log
outputs a list of committer dates, sorted from recent commits to less recent commits. Grab the creation date by using the tail
command.