My team alternates between usage of dev and master as default branch for several repos and I would like to write a script that checks for the default branch when entering a
git rev-parse --abbrev-ref origin/HEAD will print origin/. The git symbolic-ref answers are doing the same thing but need a longer argument.
If the origin repository changes its default branch name, then git remote set-head origin -a will retrieve the new default branch name.