Created
October 20, 2022 09:44
-
-
Save florianpasteur/fa1d93a02b07afa31e76bea72d7f8d61 to your computer and use it in GitHub Desktop.
Extract commit diff as markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printCodeFileAsMarkdown() { for filepath in "$@"; do | |
filename=$(basename -- "$filepath") | |
dir=$(dirname -- "$filepath") | |
extension="${filename##*.}" | |
if [ -f "$filepath" ]; then | |
echo "\`$filename\` under \`$dir\`:" | |
echo "" | |
echo "\`\`\`$extension" | |
cat "$filepath" | |
echo "\`\`\`" | |
echo "" | |
else echo "Delete $filepath"; fi | |
done; } | |
printCodeFileAsMarkdown $(git diff --name-only @~1 | grep -v playwright | grep -v tests | grep -v package.json) | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment