NEW: Script to see if commit in current branch is already in master
This commit is contained in:
Executable
+19
@@ -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
|
||||||
Reference in New Issue
Block a user