Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to count total Line of Code LOC in Bitbucket Repo

Azfar_Masut
Contributor
April 10, 2018

How to count the total LOC in Bitbucket's repo bare-repo?

1 answer

1 vote
Azfar_Masut
Contributor
April 10, 2018 edited
#!/bin/bash

targetPath=/data/atlassian/bitbucket-data/shared/data/repositories/
temp=0
total=0
filename=branch_count.log
log=$targetPath/$filename
echo "Script Start -- $(date +%Y%m%d_%H%M)" >> $log

for f in `find $targetPath -maxdepth 1 -type d`;
do
cd $f
pwd | tee -a $log
for file in $(git ls-tree --name-only -r HEAD);
do
temp=`git show HEAD:"$file" | grep -v ^\# | wc -l`
total=$(($total + $temp))
echo $temp | tee -a $log
done
done

echo "Script End -- Total Branch in all Repo:$total" | tee -a $log

 Sorry about the messy scripts. Rather amateur and in rush!

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, out of office, loom, confluence, async collaboration, meeting recaps, remote teamwork, team alignment, knowledge sharing, AI-powered notes, productivity tools, workforce continuity, teamwork collection

Put your meeting notes on autopilot with Loom + Confluence

AI-powered meeting notes keep work moving even if you’re out of the office. Enjoy your well-deserved time off and return refreshed, confident you’ll catch up in no time.

Learn more
AUG Leaders

Atlassian Community Events