> For the complete documentation index, see [llms.txt](https://yu-sun.gitbook.io/essential-git-for-scientists/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yu-sun.gitbook.io/essential-git-for-scientists/basic-operations/make-a-branch.md).

# Make a Branch

Every commit belongs to at least one branch. The default branch is typically named `master` or `main`.

### View current branch

To view which branch you're current at, use `git branch`:

```bash
λ git branch
* master
```

This tells that I'm currently on the `master` branch.

### Create a new branch

You can do this in two steps:

* Create a branch: `git branch <name>`
* Change to that branch: `git checkout <name>`

Or do it in just one step: creating then changing to that branch: `git checkout -b <name>`.

```bash
λ git checkout -b new
Switched to a new branch 'new'

λ git branch
  master
* new
```

Here I create a branch called `new`. When calling `git branch` again it shows I'm on branch `new`.
