One specific use case: determine the default branch for a remote.
This SO post suggests the use of git remote show <remote>, which produces output like the following:
* remote origin
Fetch URL: git@github.com:dswisher/git-exec-wrapper.git
Push URL: git@github.com:dswisher/git-exec-wrapper.git
HEAD branch: develop
Remote branches:
develop tracked
main tracked
refs/remotes/origin/nuke stale (use 'git remote prune' to remove)
Local branches configured for 'git pull':
develop merges with remote develop
main merges with remote main
Local refs configured for 'git push':
develop pushes to develop (up to date)
main pushes to main (up to date)
Note the HEAD branch line, which is the default branch for the remote.
One specific use case: determine the default branch for a remote.
This SO post suggests the use of
git remote show <remote>
, which produces output like the following:Note the
HEAD branch
line, which is the default branch for the remote.