#!/bin/bash echo "=========================================================================" echo "This script will check if master branch contains commit from this branch." echo "Then suggest if the branch can be deleted" echo "=========================================================================" echo "" CURRBRANCH=$(git branch --show-current) COMMITID=$(git rev-parse HEAD) git switch -q master git log | grep $COMMITID if [ $? -eq 1 ]; then echo "commit not found in master. You should keep $CURRBRANCH" else echo "commit found in master. You should delete $CURRBRANCH" git log -n1 $COMMITID fi git switch -q $CURRBRANCH