Download Remote Repository and Merge to Local Repository – Git Pull

Merging Remote Changes Locally with git pull

Pull is used when you want to download the latest Remote Repository information and merge it with the existing branch in the Local Repository. git pull is the command used to execute the pull action. The git pull command is often explained as a shortcut command for git fetch and git merge. As the git pull command shortcuts the manual checking process of the Remote Repository information, it may create a conflict. For a simple operation, you can use the pull command. However, generally, it is safer to use the git fetch command and check the Remote Repository status first before executing the git merge command.

For a better understanding, please go through the following practice section.

Practice

Objective:
Check how the pull operation works from both the repository owner and collaborator's points of view

In this practice, we'll use the following two users: Developer A and Developer B.

1. Download the project files for the first time: $ git clone

This is the same step we explained in Chapter 3. As we are using a different repository, you need to go through the same process again.

bloovee-round-icon.pngAction by Developer A

Before Developer B accesses the Remote Repository, Developer A needs to grant access to it.

Go to Settings of the repository and select Manage access. Press the green button to add a collaborator.

Add a collaborator to a GitHub repository: Step 1

Find a collaborator. In this demo, we invite sky-blue2022 (Developer B).

Add a collaborator to a GitHub repository: Step 2

Next, we'll be explaining the steps from Developer B's point of view.

skyblue-round-icon.png