This study will describe the procedure for pull changes from a specific branch in Git.
How to Pull Changes From a Specific Branch in Git?
For instance, we have a local branch named “main”, which is set to track a remote branch with a similar name in our Git local repository. To pull changes from the specified directory, check out the below section.
Step 1: Launch Git Bash
Search the “Git Bash” with the help of the “Startup” menu and open it on your system:
Step 2: Navigate to Git Repository
Next, navigate to the specified Git repository in which you need to pull changes using the below command:
Here, “mari_khan” is our Git local repository:
Step 3: Pull Changes
Now, pull all changes from a specific branch through the below-provided command. Here, the “origin” and “main” remote branches of our “mari_khan” remote repository from where the changes are pulled and merged into the local checked-out branch:
The below output indicates that everything is up-to-date and we have already pulled changes from a specific branch “main”. However, in your case, the output might be different:
We have provided the method of pulling changes from a specific branch in Git.
Conclusion
To pull changes from a specific branch in Git, first, launch the “Git Bash” on your system. Next, move to the Git local repository using the “cd” command. After that, execute the “$ git pull origin main” command to pull all changes from the origin and main branch and merge them in the local checked-out branch. In this study, we have illustrated the procedure of pulling changes from a specific branch in Git.