Article version: GitHub.com

About branches

Use a branch to isolate development work without affecting other branches in the repository. Each repository has one default branch, and can have multiple other branches. You can merge a branch into another branch using a pull request.

You can use branches to:

For more information, see "Creating and deleting branches within your repository."

Once you're satisfied with the changes in your branch, you can open a pull request to merge your branch (the head branch) into another branch (the base branch). For more information, see "About pull requests."

You can also use a branch to publish a GitHub Pages site. For more information, see "What is GitHub Pages?"

You must have write access to a repository to create a branch, open a pull request, or delete and restore branches in a pull request. In repositories where you have owner or admin access, you can change the default branch. For more information, see "Access permissions on GitHub" and "Managing branches in your repository."

Working with protected branches

Repository administrators can enable protections on a branch. If you're working on a branch that's protected, you won't be able to delete or force push to the branch. Repository administrators can additionally enable several other protected branch settings to enforce various workflows before a branch can be merged.

Note: If you're a repository administrator, you can merge pull requests on branches with branch protections enabled even if the pull request does not meet the requirements, unless branch protections have been set to "Include administrators."

To see if your pull request can be merged, look in the merge box at the bottom of the pull request's Conversation tab. For more information, see "About protected branches."

When a branch is protected:

Further reading

Ask a human

Can't find what you're looking for?

Contact us