How to set the default branch in GitHub.com?
Solution 1
Do you have to be the repo owner?
Yes you do.
How to set the default branch on github.com when I go to browse commits.
If you fork the repository, you can change the default branch of your fork, by clicking on the Settings button (see below).
This will allow you to pick your favorite branch as the default one for your own fork, but you'll have to keep your forked repository in sync with the upstream repository by yourself.
Or you can directly jump to the following url https://github.com/{:user}/{:repo}/settings
Solution 2
Just log into your GitHub account and on the far right side in the navigation menu choose Settings, in the Settings Tab choose Default Branch and return back to main page of your repository.
Here's a visual for the answer:
Solution 3
2021 Update
The current GitHub UI has changed quite a bit -- what used to be buttons are now tabs across the top of the repo's home page:
Click the Settings tab then, on the left, click Branches:
Mousing over the switch branch icon (right/left arrow, bottom right of pic) pops up a hint. [or click the pencil icon to give the default branch a new name]:
Clicking on switch branch pops up a list of branches:
Select the new default branch (I chose master), click Update, and acknowledge that you know what you're doing:
Voila!
Solution 4
This is pretty easy from the github interface. You just need to go into the repository where you want to change de default branch and click on settings on the right side of the page:
and then, inside there you just need to change the branch as you would like to:
Solution 5
Initially, I confirmed the "Default Branch" was 'master' even though clones were defaulting to another branch 'stackato'. Here's what I tried...
Change and change back
- The main/top option in the settings is titled "Options" and I changed my "Default Branch" from 'master' (what I wanted) to a third branch name that I did not want, but different from 'stackato' that was appearing when I cloned
- I selected "Collaborators" from the menu on the left
- I selected "Options" again from the menu on the left and confirmed that my selection from #1 was still active (telling me it had presumably auto-saved)
- I changed my "Default Branch" back to 'master'
- I selected "Collaborators" again from the menu on the left
- I selected "Options" one last time from the menu on the left and confirmed that my 'master' was still active (telling me it had presumably auto-saved)
and/or Wait a while
I cannot rule out the possibility that it just took some time for my change to 'propagate'.
B Seven
Status: Hood Rails on HTTP/2: Rails HTTP/2 Rack Gems: Rack Crud Rack Routing Capybara Jasmine
Updated on September 10, 2021Comments
-
B Seven over 2 years
I found the following info, but didn't find where to go to access it. Didn't find it in account settings. Is there a repo settings page? Do you have to be the repo owner?
https://github.com/blog/421-pick-your-default-branch
How to set the default branch on github.com when I go to browse commits.
-
B Seven almost 12 yearsThat's probably why I didn't find it.
-
mkrieger1 over 2 yearsHow does returning back to the main page contribute to changing the default branch?
-
mkrieger1 over 2 yearsThis answer appears to be outdated.