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
parent
e89403d59b
commit
a14d9cb6ea
|
|
@ -199,7 +199,7 @@ function gdv() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_default_branch() {
|
function get_default_branch() {
|
||||||
if git branch | grep -q main; then
|
if git branch | grep -q '^main$'; then
|
||||||
echo main
|
echo main
|
||||||
else
|
else
|
||||||
echo master
|
echo master
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue