Look for branches that are literally the word main

I have a repo with many other branches that contain the string `main`,
but our default branch is still master.  This grep was seeing those other branches
and deciding that my default branch was `main`.  This tighter regex
fixes that behavior for me.
pull/1981/head
William Richard 2021-10-22 11:19:21 -04:00
parent e89403d59b
commit a14d9cb6ea
No known key found for this signature in database
GPG Key ID: ACD9DA4E735E6D14
1 changed files with 1 additions and 1 deletions

View File

@ -199,7 +199,7 @@ function gdv() {
}
function get_default_branch() {
if git branch | grep -q main; then
if git branch | grep -q '^main$'; then
echo main
else
echo master