Skip to content

Instantly share code, notes, and snippets.

@MCMi460
Last active June 7, 2023 08:19
Show Gist options
  • Save MCMi460/7832441af7e3ad2776d393757a3bb660 to your computer and use it in GitHub Desktop.
Save MCMi460/7832441af7e3ad2776d393757a3bb660 to your computer and use it in GitHub Desktop.
Counts number of lines in a Git repository. Use at root.
#!/bin/bash
# Counts number of lines in a Git repository. Use at root.
#total=0
#while IFS= read -r file; do
# lines=$(wc $file | xargs)
# total=$(($total+${lines%% *}))
#done <<< "$(git ls-files)"
#echo "There are $total lines in this repository!"
echo "There are $(git ls-files | xargs wc -l | tail -1 | xargs) lines in this repository!" # ...or
# I could not
# be a total moron
# and waste twenty
# minutes writing this
@MCMi460
Copy link
Author

MCMi460 commented Jun 7, 2023

I feel so dumb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment