Skip to content

Instantly share code, notes, and snippets.

@AlexBaranosky
Last active August 29, 2015 13:56
Show Gist options
  • Save AlexBaranosky/8911573 to your computer and use it in GitHub Desktop.
Save AlexBaranosky/8911573 to your computer and use it in GitHub Desktop.
(defun g-blame ()
"Which commits last affected this line?"
(interactive)
(shell-command
(format "git show $(git blame '%s' -L %s,%s | awk '{print $1}')"
(buffer-file-name)
(line-number-at-pos)
(line-number-at-pos))))
(defun g-churn ()
"Which files have changed the most in the past 6 months?"
(interactive)
(shell-command
"set -e; git log --all -M -C --name-only --format='format:' \"--since='6 months ago'\" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print \"count\tfile\"} {print $1 \"\t\" $2}' | sort -g | tail -50"))
(defun g-who ()
"Who has changed this file the most in the past 6 months?"
(interactive)
(shell-command
(concat "git log --format='%an' --since='6 months ago' "
(buffer-file-name)
" | sort | uniq -c | sort -rn")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment