function __git.default_branch -d "Use init.defaultBranch if it's set and exists, otherwise use main if it exists. Falls back to master" command git rev-parse --git-dir &>/dev/null; or return if set -l default_branch (command git config --get init.defaultBranch) and command git show-ref -q --verify refs/heads/{$default_branch} echo $default_branch else if command git show-ref -q --verify refs/heads/main echo main else echo master end end