Skip to content

Instantly share code, notes, and snippets.

@Oreoxmt
Last active September 23, 2022 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oreoxmt/862f24cec9a5915c71019dea2795c423 to your computer and use it in GitHub Desktop.
Save Oreoxmt/862f24cec9a5915c71019dea2795c423 to your computer and use it in GitHub Desktop.
Generate a last commit report of a folder
#!/bin/bash
set -e
DIR=$1
REPO=$2
FIND=$(which gfind || which find)
SED=$(which gsed || which sed)
(
echo '| File | Last Commit Author | Last Commit Date | Relative Date |'
echo '| ---- | ------------------ | ---------------- | ------------- |'
(
cd "$DIR"
$FIND . -name '*.md' | $SED 's~^./~~' | while read -r FILE; do
git --no-pager log -1 --format=format:'%at | '"[$FILE](https://github.com/$REPO/blob/%H/$FILE)"' | %an | %as | %ar |%n' "$FILE"
done
) | sort --numeric-sort | $SED -E 's~^[0-9]+ ~~'
) >"$DIR"_commit_log.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment