Git

Pull a Certain Branch from the Remote Server

Git is the most widely used shared development environment for tracking the added changes in the development project source code. In the Git local repository, developers have multiple local branches for each module that track remote branches to the local repository. However, sometimes developers want to track the updates of a certain Git remote branch placed in the remote server.

This write-up will provide the method to pull a particular branch from the Git remote server.

How to Pull a Particular Branch from the Remote Server?

To pull a certain branch from the remote server, first, change to the local directory and clone the Git remote repository. Then, run the “$ git pull origin <remote-branch>” command to pull the certain branch from the remote server.

Now, let’s toward the procedure of the provided instructions!

Step 1: Navigate to Directory
Move to the Git directory where the local repository exists:

$ cd "C:\Users\nazma\Git\Demo14"

Step 2: Clone Remote Repository
Next, clone the required remote repository to the local repository by executing the “git clone” command:

$ git clone https://github.com/GitUser0422/demo3.git

Step 3: Pull Remote Branch
Lastly, run the “git pull” command along with the remote repository and branch name:

$ git pull origin master

Here, you can see the particular “master” remote branch is pulled successfully:

That’s all! We have provided the method to pull a particular branch from the Git remote server.

Conclusion

To pull a certain branch from the remote server, first, change to the local directory and clone the Git remote repository by executing the “$ git clone <remote-url>” command. Run the “$ git pull origin <remote-branch>” command to pull the certain branch from the remote server. This write-up discussed the method to pull a particular branch from the Git remote server.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.