Skip to main content

GitKit (VSCode Edition): Learn git and GitHub in Context

Section 5.2 Synchronizing with the Upstream Repository

Figure 5.2.1 shows the main branch has committed changes that conflict with what the local branch wants to commit.
Cloud image of the changes merged into the upstream that conflict with a local branch
Figure 5.2.1. Conflicting Upstream Changes.
In class we saw that the maintainers had merged some changes into the upstream main after you had created your feature branch. The changes that were merged were specifically designed to conflict with the changes required for each of the Round2 issues. Thus, the pull request that you made at the end of the previous activity will now contain conflicts that prevent it from being merged automatically. This situation is shown in Figure 5.2.1, where the maintainers have merged the dark blue commit into the main branch.
The activities in the remainder of this section will have you confirm that you are out of synch with the upstream and that your pull request cannot be merged automatically. It will then have you synch the main branch in your local and origin repos with the upstream, so that you can resolve the merge conflict.
Like the last activity, you will be working within the KitClient for this activity.

Exercises

2.

Answer the following based on Figure 5.2.1.
(a)
    Which of the commits (i.e. which colors) in Figure 5.2.1 might contain merge conflicts after the dark blue commit was merged?
  • Dark Blue
  • Lime Green
  • Brown
  • Green
Hint.
Look at which commits are new in upstream that are not part of the local repository’s main or feature branch.

3.

Visit the main page for your origin repo on GitHub and make sure that the main branch is active. You should be able to tell from this page that there have been changes to the upstream main branch that you have not yet synched (i.e. you are behind).
How many commits behind the upstream are you?

4.

Now find your pull request in the upstream repo on GitHub. You should see that your pull request cannot be merged automatically.
  • If GitHub indicates that your pull request can be merged automatically follow the instructions in Section 5.10 at the end of this activity sheet and then return to this question when you have a pull request that cannot be merged automatically.
  • Do not continue unless your pull request on GitHub shows that it cannot be merged automatically.
(a)
    Does your pull request on GitHub show that it cannot be merged automatically?
  • True.

  • If you don’t have a merge conflict, you can’t do the rest of the exercises in this section.
  • False.

  • If you don’t have a merge conflict, you can’t do the rest of the exercises in this section.
(b)
Briefly explain in a sentence or two of your own words, what happened that made your pull request go from being able to be merged automatically to now not being able to be merged automatically.
Hint.

5.

Use what you learned in the prior chapter to synch the main branch of your local and origin repos with the upstream. Don’t forget to switch to your main branch first!
(a)
What are the commands you used?
(b)
Check that you are now synchronized:
  • Check that the main branch on your origin repo on GitHub "is up to date…" (See Exercise 5.2.3).
  • Use git status to check that the main branch in your local repo is up to date with your origin.
If the main branch in your local or origin repos are not up to date, double check your synchronization commands in part Task 5.2.5.a and try again.
You have attempted of activities on this page.