You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
659 B
27 lines
659 B
5 years ago
|
#!/bin/bash
|
||
|
|
||
5 years ago
|
# Prints the number of commits between branches and a main branch (master by defaunt)
|
||
|
|
||
5 years ago
|
mainBranch="${1-master}"
|
||
|
|
||
|
|
||
5 years ago
|
for branch in $(git branch -a --format "%(refname:short)"); do
|
||
5 years ago
|
|
||
|
if [ "$branch" = "$mainBranch" ]; then
|
||
|
continue;
|
||
|
fi
|
||
|
|
||
|
masterInFront=$(git log --oneline "$branch".."$mainBranch" | wc -l)
|
||
|
branchInFront=$(git log --oneline "$mainBranch".."$branch" | wc -l)
|
||
|
|
||
|
if [ "$masterInFront" = "0" ] && [ "$branchInFront" = "0" ]; then
|
||
|
echo "$mainBranch and $branch are in sync"
|
||
|
else
|
||
|
echo "$mainBranch is $masterInFront commits in front of $branch"
|
||
|
echo "$branch is $branchInFront commits in front of $mainBranch"
|
||
|
fi
|
||
|
|
||
|
echo ""
|
||
|
|
||
|
done
|