Skip to content

Instantly share code, notes, and snippets.

@tushar-rishav
Created August 13, 2015 19:45
Show Gist options
  • Save tushar-rishav/62622a50f36f2ff220d8 to your computer and use it in GitHub Desktop.
Save tushar-rishav/62622a50f36f2ff220d8 to your computer and use it in GitHub Desktop.
Count the total lines of code in a repo

Install cloc if not done already

  npm install -g cloc                    # https://www.npmjs.com/package/cloc
  sudo apt-get install cloc              # Debian, Ubuntu
  sudo yum install cloc                  # Red Hat, Fedora
  sudo pacman -S cloc                    # Arch
  sudo pkg install cloc                  # FreeBSD
  sudo port install cloc                 # Mac OS X with MacPorts

Usage

  cloc local_repo_path

Alternative

git ls-files | grep "\(.html\|.css\|.js\|.py\|.php\|.clj\|.c\|.cpp\)" | xargs wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment