Alias to run “git switch” regardless of whether the default branch is main or master.
GitHub has changed the default branch from master to main, but repositories created before the change may still be master.
You can git switch them by creating the following alias and running the gitswdb.
alias gitswdb="git switch $(git symbolic-ref refs/remotes/origin/HEAD | cut -f4 -d'/')" If you are using git checkout, rewriting switch to checkout should work.