NEW: Script to see if commit in current branch is already in master

This commit is contained in:
xpk
2025-02-19 16:58:05 +08:00
parent 3fc4f0e24b
commit ad638bb6fb
+19
View File
@@ -0,0 +1,19 @@
#!/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