Advertisement

Shell Script to Test Last Git Commit

In developing a solid Continuous Integration system, I’ve had to learn many important and useful bash script tricks. Here’s one to test the name of the last committer.

git log --pretty=format:"%an" -1
named=$(git log --pretty=format:"%an" -1 2>&1)
echo $named
if [[ $named == "Peter" ]] then
echo "MATCHED"
else
echo "NOT"
fi