Skip to content

Instantly share code, notes, and snippets.

View gitcheats.txt
# List all files in a folder in a git repository by last commit date
git ls-tree --name-only HEAD foldername/ | while read filename; do echo "$(git log -1 --format="%ci " -- $filename) $filename"; done | sort -r
# plot commits per hour
git log --format=format:'%ai' --all | cut -d " " -f 2 | cut -d ":" -f 1 | sort | uniq -c | gnuplot -e "set output 'commits-per-hour.png'; set term png truecolor giant; set ylabel 'Commits'; set grid y; set boxwidth 0.9 relative; set style fill transparent solid 1.0 noborder; plot '-' using 1:xtic(2) with boxes lc rgb'green' notitle;"
# list all tags
git fetch --all --tags --prune
# sort git tags by date