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.
![The remote branch is upstream from the local branch. Diagram displaying an updatream branch.](/static/552cafbef8bd4368b619449e22702322/5a190/01.png)
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.](/static/99a76c2026cd715b8a71fbdce94dc836/5a190/02.png)
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.
![Git must merge and commit before a pull if the local branch differs from the remote branch. Diagram displaying a merge and commit before a pull.](/static/04a22a905afb3b77b2a29d5673d147fc/5a190/03.png)
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.](/static/d309d34e7532888bd28c7927986bcda7/5a190/04.png)
If there is no conflict, the commit will merge automatically.