Naming Things is Hard

Get the history of the number of lines in a file over history from a git repo

This is a dumb thing I like to look at now and then, which technique I'm putting here because I keep forgetting where I put it, and I look here, and it's never actually here. I'm also not putting in in my usual pre/code tags here, because that breaks the site design, because I am a terrible site owner.

git log --shortstat --reverse --pretty=oneline ./app.css | grep '1 file changed' | awk -F',' '{if ($2 ~ /insertion/) {upholder = split($2, insertions, " "); up = insertions[1]} else {up = "0"}; if ($2 ~ /deletion/) {downholder = split($2, deletions, " "); down = deletions[1]} else if ($3 ~ /deletion/) {downholder = split($3, deletions, " "); down = deletions[1]} else {down = "0"}; total = total + up - down; print total;}'

So basically what you wind up with is a big pile of numbers you can shoot off into a spreadsheet or a graphing app of your own choosing to look at how the file changes over times (where time is represented as commits). There's probably a way to that from the command line, too, that I haven't spent enough time finding, yet.

There's probably also a way to pull out date information so time can actually be, like, time, but. I have other things to do with my time these days.

tags

Home & About & Micro.blog & Feed (Atom)