# Git Fetch and Switch to a Remote Branch Locally

> Fetch a remote Git branch and check it out locally with git fetch and git switch, which creates a local tracking branch for pushing and pulling

**URL:** https://sentry.io/answers/fetch-a-remote-branch-in-git/

---

## The Problem

In my Git repository, how do I fetch a branch from a remote to start working on locally? There is no equivalently named branch in my local repository.

## The Solution

We can do this using [`git fetch`](https://git-scm.com/docs/git-fetch) to retrieve the remote branch and [`git switch`](https://git-scm.com/docs/git-switch) to work on it locally. First, fetch from the remote so your local repository knows about the branch:

```bash
git fetch origin
```

Then switch to it:

```bash
git switch remote-branch
```

`git switch` will create a local branch named `remote-branch` that tracks `origin/remote-branch` and check it out. We can then make commits, push them, and pull others' commits from this branch as usual.

---

*Source: [sentry.io/answers/fetch-a-remote-branch-in-git/](https://sentry.io/answers/fetch-a-remote-branch-in-git/)*
