How to set the default branch in GitHub.com?

23,990

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.

settings

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:

enter image description here

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:

current default branch is 1.8

Click the Settings tab then, on the left, click Branches:

Branches option

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]:

mousing over switch branch icon

Clicking on switch branch pops up a list of branches:

branch list

Select the new default branch (I chose master), click Update, and acknowledge that you know what you're doing:

acknowledge new default

Voila!

master is new default branch

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:

enter image description here

and then, inside there you just need to change the branch as you would like to:

enter image description here

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

  1. 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
  2. I selected "Collaborators" from the menu on the left
  3. 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)
  4. I changed my "Default Branch" back to 'master'
  5. I selected "Collaborators" again from the menu on the left
  6. 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'.

Share:
23,990
B Seven
Author by

B Seven

Status: Hood Rails on HTTP/2: Rails HTTP/2 Rack Gems: Rack Crud Rack Routing Capybara Jasmine

Updated on September 10, 2021

Comments

  • B Seven
    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
    B Seven almost 12 years
    That's probably why I didn't find it.
  • mkrieger1
    mkrieger1 over 2 years
    How does returning back to the main page contribute to changing the default branch?
  • mkrieger1
    mkrieger1 over 2 years
    This answer appears to be outdated.