Pull updates and resolve a conflict
Understand how to update a local branch, merge changes, and resolve overlapping edits.
Bring a remote update into your local repository
git switch main
git pull origin main
git pull gets new commits from a remote branch and integrates them into the currently checked-out branch. In this example, you first switch to local main, then bring in the latest main from origin—your GitHub repository. After the first pull request is merged on GitHub, your local main does not update by itself; this pull brings that change down to your computer.
Check git status after pulling. It helps confirm which branch is active and whether the working tree is ready for the next operation.
Merge one branch into another
git switch <second-lead-branch>
git merge main
git merge combines the history of the named branch into the branch you currently have checked out. Here, the second lead branch receives the newly updated main. If both branches changed different lines, Git can usually combine them automatically.
If both branches changed the same part of a file in different ways, Git pauses and reports a merge conflict. It cannot infer which wording best represents the evidence, so a person has to review the competing changes and create a correct combined result.
Read and resolve conflict markers
When Git cannot combine a text file automatically, it places markers around the competing content:
| Marker | What it separates |
|---|---|
<<<<<<< HEAD |
The version from your current branch |
======= |
The two competing versions |
>>>>>>> main |
The version from the branch being merged |
The labels identify the two sides of the merge; they are not part of the final content. Edit the file so it contains the intended result, retaining the information the case supports and removing all marker lines. The app tells you which file to inspect, while the evidence determines the right resolution.
Then use:
git status
git diff
git add <resolved-file>
git diff --staged
git commit -m "Resolve the case summary conflict"
git push
git status identifies files that still need resolution. Once you have edited a conflicted file, git add tells Git that you resolved it; staging does not decide whether the content is correct, so review it with git diff --staged. The commit records the merge result on your current branch, and the push updates its GitHub branch so the pull request can be reviewed again.
After the second pull request is merged, you can inspect the completed timeline with git log --oneline --graph. The graph view helps show where the branches shared history and where their commits came together.
If Git reports an unresolved conflict
Do not switch branches or start another merge while Git reports unmerged paths. Open each listed file, remove the conflict markers by creating the intended final text, save it, and stage the resolved file. Run git status again; Git should no longer list unmerged paths before you create the resolution commit.
If the file is confusing, stop and compare both versions with the case evidence and the pull request diff. The activity’s help steps can guide the Git operation without giving away the mystery answer.