Git Tips

Git Tips

Get Default Branch Name Locally

1
basename $(git symbolic-ref refs/remotes/origin/HEAD)

if you’re facing an error like

1
fatal: ref refs/remotes/origin/HEAD is not a symbolic ref

you can use the following command to fix it

1
git remote set-head origin --auto
Licensed under CC BY-NC-SA 4.0