#!/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!
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.