Skip to content

Instantly share code, notes, and snippets.

@CJHwong
Created December 12, 2022 13:12
Show Gist options
  • Save CJHwong/7bb70be81e08a2615a42e7ea1a7d935c to your computer and use it in GitHub Desktop.
Save CJHwong/7bb70be81e08a2615a42e7ea1a7d935c to your computer and use it in GitHub Desktop.
ALL_FILES=$(git ls-files)
echo "filename,commit_ct,last_updated_at"
while IFS= read -r FILENAME
do
COMMIT_CT=$(git --no-pager log --pretty=tformat:"%h" ${FILENAME} | wc -l | sed 's/ //g')
LATEST_UPDATED_AT=$(git --no-pager log -1 --pretty="format:%ci" $FILENAME)
echo "${FILENAME},${COMMIT_CT},${LATEST_UPDATED_AT}"
done < <(printf '%s\n' "$ALL_FILES")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment