Skip to content

Instantly share code, notes, and snippets.

@nwjlyons
Last active September 20, 2016 10:46
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 nwjlyons/f13ba513fd341c4140168c8fb81fbe4b to your computer and use it in GitHub Desktop.
Save nwjlyons/f13ba513fd341c4140168c8fb81fbe4b to your computer and use it in GitHub Desktop.
Sort local branches by line count.
#!/usr/bin/env bash
git branch | while read BRANCH ; do
git checkout $BRANCH &> /dev/null;
LINE_COUNT=`wc -l $(git ls-files | grep "\(.html\|.py\)$") | tail -n 1`
echo "$LINE_COUNT $BRANCH"
done | sort -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment