Prefer "main" to "master"

See
1e7fa50da0.

> This commit introduces `git-master-to-main-wrapper`, which seamlessly
prefers `main` to `master` but works fine with repos that do use
a `master` branch.
This commit is contained in:
Oliver Davies 2020-07-19 21:58:21 +01:00
parent 2e8c717036
commit 0f797c6ffe
4 changed files with 40 additions and 4 deletions

10
bin/main-or-master-branch Executable file
View file

@ -0,0 +1,10 @@
#!/bin/zsh
# Check if we should use the `main` or `master` branch for this repo.
# Prefer `main` to `master`.
if git show-ref --quiet origin/main || git rev-parse main &>/dev/null; then
echo main
else
echo master
fi