You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
( set -- `git ls-remote --symref origin HEAD`
test $1 = ref: && echo $2 )
NB. <remote_name> is normally origin)
Assign an alias branch name and use it in scripts
Option 2a. git symbolic-ref refs/heads/default refs/heads/<default-branch>
Note: one can still checkout default as such and any operations with default branch will just update the bound branch pointer. Current branch will be the bound branch, however bash prompt still may show default
The text was updated successfully, but these errors were encountered:
Option 1a.
git remote show <remote_name> | grep 'HEAD branch' | cut -d' ' -f5
Option 1b.
git branch -r --points-at refs/remotes/origin/HEAD | grep '\->' | cut -d' ' -f5 | cut -d/ -f2
Option 1c.
git remote show <remote_name> | awk '/HEAD branch/ {print $NF}'
Option 1d.
Option 1e.
git rev-parse --abbrev-ref origin/HEAD
will printorigin/<default-branch-name>
Option 1f.
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
Option 1g.
git remote show <remote_name> | grep "HEAD branch" | cut -d ":" -f 2
Option 1i.
NB.
<remote_name>
is normallyorigin
)Option 2a.
git symbolic-ref refs/heads/default refs/heads/<default-branch>
Note: one can still checkout
default
as such and any operations withdefault
branch will just update the bound branch pointer. Current branch will be the bound branch, however bash prompt still may showdefault
The text was updated successfully, but these errors were encountered: