Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the default branch in GitHub.com?

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.

like image 475
B Seven Avatar asked Jul 04 '12 18:07

B Seven


People also ask

What is the default branch of a GitHub repository?

The default branch is also the initial branch that Git checks out locally when someone clones the repository. Unless you specify a different branch, the default branch in a repository is the base branch for new pull requests and code commits. By default, GitHub names the default branch main in any new repository.

Why is GitHub default branch?

GitHub took action based on the Conservancy's suggestion and moved away from the term master when a Git repository is initialized, "We support and encourage projects to switch to branch names that are meaningful and inclusive, and we'll be adding features to Git to make it even easier to use a different default for new ...

Can you change main branch in GitHub?

Under your repository name, click Settings. In the left menu, click Branches. Under "Default branch", to the right of the default branch name, click . Use the drop-down, then click a branch name.


2 Answers

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

like image 176
nulltoken Avatar answered Sep 19 '22 07:09

nulltoken


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

like image 27
Matija Avatar answered Sep 22 '22 07:09

Matija