Skip to content

Instantly share code, notes, and snippets.

@allyjweir
Created October 22, 2019 10:30
Show Gist options
  • Save allyjweir/1e6df07e3a50135943d0998f62bfe7db to your computer and use it in GitHub Desktop.
Save allyjweir/1e6df07e3a50135943d0998f62bfe7db to your computer and use it in GitHub Desktop.
#!/bin/bash
# Lists files in directory with date added and SHA of commit in which they were
# added.
#
# Handy for:
# - Figuring out order of DB migrations
# - ???
#
# Adapted from: https://stackoverflow.com/questions/10975563/how-can-i-see-the-date-multiple-files-were-created-on-git
for file in $(git ls-files)
do
HASH=$(git rev-list HEAD "$file" | tail -n 1)
DATE=$(git show -s --format="%ci" $HASH --)
printf "%-25s | %-30s | %-100s\n" "$DATE" $HASH "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment