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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user