Show Default Git Branch
In the world of differently named default Git branches (e.g., master, main, trunk, etc.), writing commands that reference the default branch and work everywhere is a pain. Thankfully, we can solve this with a single Git alias.
~/.gitconfig
[alias]
default = !basename $(git symbolic-ref --short refs/remotes/origin/HEAD)
Now, just run git default
and it will print the default branch name!