KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a local repository which I cloned through git clone --mirror <ssh-url> . I then keep it up to date using git remote update --prune . At this point, HEAD points to refs/heads/master I then go to the Admin section of my github repository, and change the default branch. All of my branches are updated as normally, but HEAD is still refs/heads/master (yes, the branches have different hashes) My current thought is to use git ls-remote to get the hash of HEAD and all branches, then with some grep/awk magic, extract the hash of HEAD and then choose the first branch with a matching hash, and use git symbolic-ref HEAD <found branch name> to set it locally. But is there a simpler way to get the remote HEAD branch name (in a manner that it can be updated in a script)?
Tags (comma-separated)
Save Edits
Cancel