dotfiles/script/gitmainbranch

18 lines
242 B
Plaintext
Raw Normal View History

2023-07-07 10:08:50 +00:00
#!/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