Skip to main content

GitKit (2nd ed.) Learn git and GitHub in Context

Section 5.3 Synchronizing with the Upstream Repository

From the previous section you know that there is a merge conflict between the upstream main branch and your feature branch. Before you can resolve this conflict you will need to get the changes from the upstream main branch into your local and origin main branches.
The process you learned for synchronizing with the upstream in Chapter 4 Staying Synchronized with the Upstream (Section 4.4 Pulling the Upstream main Branch and Section 4.5 Pushing main to Your Origin) will copy the changes in the upstream main branch into your local and origin main branches. This process is illustrated in Figure 5.3.1.
Using pull and push to synchronize the local and origin main branches with the upstream main branch.
Diagram showing the upstream repository main branch incorporating the changes from having merged another fork’s pull request. To synchronize, the owner of the local repository has pulled the changes in upstream main into the local main, and then pushed the local main to origin main, so that all three repositories contain the same sequence of commits in their respective main branch.
Figure 5.3.1. Synchronizing with the upstream.
The exercises in the remainder of this section will help you to synchronize your local and origin main branches with the upstream main branch.

Exercises

1.

To do the synchronization you’ll need to have your development environment running.
Please be patient as this can take a few minutes. When the development environment is ready you will see the message "Kit development environment is ready for use." and your browser window will look similar to the following:
Image of the GitKit Development Environment showing the ready for use message.
The GitKit Development Environment. The development environment is ready when you see the "Kit development environment is ready for use" message.

2.

(a)
Assuming your feature branch is currently the active branch, arrange the the commands below into the order they would be used to synchronize your main branches with the upstream main branch. Note: Not all commands will be used.
Hint.
(c)
Let’s, confirm that your origin main branch is now synchronized with the upstream main branch.
Visit your origin repository and ensure that the main branch is active.
Near the top of the page, you should see a message that is similar to one of the following. Select the message that is most similar to what you see.
  • This branch is up to date with <the upstream>.
  • Correct! Just as it should be. Continue on to the next exercise.
  • This branch xx commits behind <the upstream>.
  • Uh Oh. It doesn’t look like your synchronization worked. Try running the commands from Task 5.3.2.a again.
Hint.
You will need to perform all of the steps from Task 5.3.2.a to synchronize your main branches.
You have attempted of activities on this page.