Skip to content

Instantly share code, notes, and snippets.

@mgurov
Last active January 3, 2016 02:49
Show Gist options
  • Save mgurov/8397959 to your computer and use it in GitHub Desktop.
Save mgurov/8397959 to your computer and use it in GitHub Desktop.
git status + checked out maven pom version + git diff to given branch
#!/bin/bash -e
#depends on xml starlet, brew install xmlstarlet
if [ $1 ]; then
BASE_BRANCH=$1
else
BASE_BRANCH=origin/master
fi
bold=`tput smso`
offbold=`tput rmso`
echo $bold
for dir in */; do
echo ${bold}$dir${offbold} `xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "x:project/x:version" $dir/pom.xml`
cd $dir
if ! git diff-index --quiet HEAD --; then
git status --short
fi
if git show-ref -q $BASE_BRANCH; then
git log $BASE_BRANCH~1.. --oneline
else
echo "-unbranched-"
fi
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment