# Creating a New Branch

See <https://git-extensions-documentation.readthedocs.io/en/latest/branches.html#create-branch>​

![](https://camo.githubusercontent.com/d875230775c5fe41fd147dcf3651c24cc2a60b3d/68747470733a2f2f6769742d657874656e73696f6e732d646f63756d656e746174696f6e2e72656164746865646f63732e696f2f656e2f6c61746573742f5f696d616765732f6e65775f6272616e63682e706e67)

Command line

```
git checkout -b <BranchName> [origin/<RemoteBranchName>]​
git checkout -b <BranchName> [CommitOrRef]
​git branch <BranchName> [CommitOrRef]
```

#### Create on top of remote branch instead of local <a href="#create-on-top-of-remote-branch-instead-of-local" id="create-on-top-of-remote-branch-instead-of-local"></a>

Most of time we'd like to create our branch basing on the remote branch for example `origin/master`, instead of a local `master`. A local `master` branch is only needed when we want to push something directly to the remote `master`. If commits are meant to be merged through pull requests, we can delete it to avoid inadvertently push to the remote `master` branch.

#### Fetch before creating <a href="#fetch-before-creating" id="fetch-before-creating"></a>

Most of time we'd like to fetch the remote branch first before creating branch, because the `origin/master` on our PC might not be up to date as the branch on remote server.

#### Fetch & Create in one go <a href="#fetch-and-create-in-one-go" id="fetch-and-create-in-one-go"></a>

In the left branch tree panel, find the remote branch, right click and select the menu `Fetch & Checkout` if want to use the same name as the local branch name or `Fetch & Create Branch` if a different name needed.

![](/files/-LS9dywa0uh0p3dswzIy)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gittutorial.gitbook.io/practical-git-via-gitextensions/how-to-create-a-new-branch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
