This study will provide the process of performing the Git pull remote branch without merging it.
How to Git Pull Remote Branch Without Merge?
In order to perform Git pull operation on the local repository without merging the remote branch with a local branch, perform the below-listed instructions:
- Go to the Git local repository.
- View the list of existing remote URLs.
- Use the “git pull <remote-name> <branch-name> –rebase” command.
- Show the list of all existing branches.
Step 1: Switch to Git Repository
At first, execute the “cd” command along with the required Git repository path and navigate to it:
Step 2: Check Remote URL List
Then, display the list of existing remote URLs through the “git remote” command along with the “-v” option:
Step 3: Git Pull Operation Without Merge
Next, execute the “git pull” command to download the copy of the remote repository to the local machine:
Here, the:
- “origin” is the name of a remote URL.
- “master” is the name of the local machine.
- “–rebase” option is used to download the remote branch without merging with the local branch.
According to the provided output, the remote “master” branch is pulled successfully without merging:
Step 4: List Remote Branches
To verify the newly pulled remote branch into the local repository, run the “git branch” command:
In the below-given output, the pulled “master” exists in the branch list:
Here, we have compiled the process to Git pull the remote branch without merging it.
Conclusion
To perform the Git pull remote branch without merging it, first, switch to the Git local repository and view the list of existing remote URLs. Then, run the “git pull <remote-name> <branch-name> –rebase” command to pull the remote branch without merging it. Lastly, show the list of all existing branches. In this study, we have illustrated the method of performing the Git pull remote branch without merging it.