Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git collaboration
  6. Remote branches
  7. Pulling remote branches
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Pulling remote branches

You can apply the latest changes from a remote repository to your local repository using the git pull command.

For example, say the remote branch is upstream of your local branch. The remote branch would include all of the local branch's changes, as shown below.

Diagram displaying an updatream branch.
The remote branch is upstream from the local branch.

In this case, if we were to apply a merge from the remote branch (origin/main) into our local branch (main), it would be a fast-forward merge.

Diagram displaying a fast-forward merge.

However, if there are changes in the local main branch are not present in the remote origin/main branch, the pull command will execute a merge and create a merge commit that ties those changes together.

Diagram displaying a merge and commit before a pull.
Git must merge and commit before a pull if the local branch differs from the remote branch.

A merge commit is automatically created in the local repository when executing a pull. If there is a conflict, you will have to resolve the conflict and commit the merge manually.

Diagram displaying no conflict auto merge.

If there is no conflict, the commit will merge automatically.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life