Download Branch From Remote Repository

While working on a large team project, every team member works on their local system and then pushes changes to GitHub. Other users download the remote branch from the GitHub repository in their local system so that they can get the latest version of the code and collaborate with other team members on the project.

This write-up will guide you about downloading a branch from a remote repository.

How to Download Branch From a Remote Git Repository?

To download the branch from the remote repository, look at the below-provided steps:

  • Navigate the local repository.
  • Add a remote URL and verify it.
  • Download the remote branch using the “git pull <remote-name> <branch-name>” command.
  • View the downloaded remote branch.

Step 1: Redirect to Local Repository

First, write out the below-stated command and switch to the desired local repository:

$ cd "C:\Git\new_Repo"

Step 2: Add New Remote

Then, run the “git remote add” command with the remote repository’s URL and link the local repository with it:

$ git remote add origin

Step 3: Verify Remote URL

Next, verify whether the remote URL has been added or not through the following command:

$ git remote -v

It can be observed that the local repository has been connected with the remote repository:

Step 4: Download Remote Branch

Now, type out the “git pull” command along with the remote and a particular remote branch name that needs to be downloaded. For instance, we want to download the remote “master” branch:

$ git pull origin master --allow-unrelated-histories

Here, the “–allow-unrelated-histories” option is utilized for telling Git that the user is allowed to combine the branches of both unrelated local and remote repositories:

Step 5: Verify Changes

Lastly, ensure whether the desired remote branch has been downloaded or not by displaying the remote branches:

$ git branch -r

Here, the “-r” option is utilized to list the available remote branches.

The below output displays the remote “master” branch, which indicates that the remote branch has been downloaded successfully:

We have explained the easiest procedure to download the branch from the remote repository.


To download the branch from the remote repository, first, redirect to the local repository. Then, connect the local repository with the remote repository and verify it. Next, execute the “git pull <remote-name> <branch-name>” command to download the desired remote branch from the GitHub repository. Lastly, view the downloaded remote branch using the “git branch -r” command. This write-up explained the method to download the branch from the GitHub repository.

About the author

Laiba Younas

I have done bachelors in Computer Science. Being passionate about learning new technologies, I am interested in exploring different programming languages and sharing my experience with the world.