dotfiles/script/gitmainbranch

18 lines
242 B
Bash
Executable File

#!/usr/bin/env bash
#
# Try to detect if the current repo has a main branch, or master.
set -e
if git branch -l | grep -q "main"; then
echo "main"
exit 0
fi
if git branch -l | grep -q "master"; then
echo "master"
exit 0
fi
exit 1