> ## Content Index
> Fetch the complete content index at: https://www.techielass.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Git clone a branch
- URL: https://www.techielass.com/git-clone-a-branch/
- Published: 2022-01-11T08:08:00.000Z
- Updated: 2022-01-11T08:08:00.000Z
- Description: Join me as I show you how you can use Git to clone a specific branch from a repository.
- Author: Sarah Lean
- Tags: Git for everyone, Git, GitHub

Have you ever just wanted to clone a certain branch from your GitHub repository to work on your local machine and don't want the other 300-odd branches that the repository might have?

Well stick around and I'll show you how to do that!

## Does git clone clone all branches?

Yes it will, which can be useful if you are working across all the branches but it can also lead to confusion and commits happening on the wrong branch. 

## Clone a specific branch

I have several branches in one of my GitHub repositories, but I just want a specific branch so I can work on that and don't need the others. 

The first I do is grab the URL for the GitHub repository, in this case it's [https://github.com/weeyin83/WorkingRepo.git](https://github.com/weeyin83/WorkingRepo.git?ref=techielass.com)

The first thing I do is open up my [Windows Terminal](https://www.techielass.com/install-windows-terminal-with-windows-package-manager/), you can use a command prompt window or even the terminal inside [Visual Studio Code](https://www.techielass.com/my-visual-studio-code-setup/). Whatever is your preference. 

I now type in the command:

```bash
git clone -b sarahmonday https://github.com/weeyin83/WorkingRepo.git

```

This specifies that I want to clone the branch *"sarahmonday"*within the WorkingRepo repository. 

![](https://storage.ghost.io/c/08/96/08960c71-63a2-449b-91b1-8d4628166dd2/content/images/2021/12/gitclonebranch.png)

Git Clone a specific branch

## Check which branches you have on your local machine

To double check what branches you have on your machine you can navigate to the new folder you have on your machine and run:

```bash
git branch

```

It should just list the branch you've just cloned. 👍

If you've found this tip useful be sure to check out my other [Git tips](https://www.techielass.com/tag/git-for-everyone/).