Skip to content

Instantly share code, notes, and snippets.

@cookieguru
Created September 29, 2018 00:57
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 cookieguru/41063dad8c644ff038364db688a9b5d1 to your computer and use it in GitHub Desktop.
Save cookieguru/41063dad8c644ff038364db688a9b5d1 to your computer and use it in GitHub Desktop.
Graphing lines of code over time
cd /path/to/your/code
mkdir ../counts
git log --format=format:"git reset --hard %H&&cloc --skip-uniqueness --force-lang=HTML,twig --sql-project=\"%ai\" --sql=../counts/%H.sql ." --no-merges > ../runme.sh
bash ../runme.sh
mysql -u root -p stats < grep -h ../counts/* insert
SELECT * FROM (
SELECT Project as Date, Language, SUM(nBlank) AS Blank, SUM(nComment) AS Comment, SUM(nCode) AS Code, SUM(nBlank) + SUM(nComment) + SUM(nCode) AS Total
FROM t
GROUP BY Project, Language
UNION
SELECT Project as Date, 'Total' AS Language, SUM(nBlank) AS Blank, SUM(nComment) AS Comment, SUM(nCode) AS Code, SUM(nBlank) + SUM(nComment) + SUM(nCode) AS Total
FROM t
GROUP BY Project
) AS x
ORDER BY Date, Language = 'Total', Language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment