Skip to main content

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

Section 5.7 Extra Practice

This section is optional but will provide you with more practice with Git, GitHub and with resolving merge conflicts if you would like it.

Exercises

1.

To do the extra practice you’ll need to have your development environment running.
Click here to open your development environment
 1 
codespaces.new/HFOSSedu/KitClient-Codespace?quickstart=1
.
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:
The GitKit Development Environment.  The development environment is ready when you see the "Kit development environment is ready for use" message.

2.

The upstream repository contains a branch created just for this extra practice. This branch was created so that it contains some pre-made conflicts with the upstream main branch.
(a)
Ensure that you are in the directory for your GitKit FarmData2 repository. Then use the following command to get this feature branch from the upstream into your local repo: git fetch upstream merge-conflict-practice
(b)
    Run the git branch -a command in the terminal to list all of the branches known to your local repository.
    Which of the following branches are listed?
  • main
  • Correct.
  • remotes/upstream/merge-conflict-practice
  • Correct.
  • development
  • Are you sure this branch exists?
  • beta
  • Are you sure this branch exists?
At this point you should think of the merge-conflict-practice branch as a feature branch that you created from your main and then made some changes that resulted in conflicts with the upstream main branch. Thinking of the merge-conflict-practice branch this way leaves you at the point where you are trying to merge the modified upstream main into your feature branch as you did in Subsection 5.4.2).

3.

Assuming that your main branch is active, select and order statements that will make the merge-conflict-practice branch active and then merge the main branch into it. Note: not all commands will be used.
Hint.
Review Subsection 5.4.2 for how to merge main into a feature branch.

4.

Merging the main branch into the merge-conflict-practice branch will create some conflicts for you to resolve.
(a)
    Execute the commands you selected in Exercise 5.7.3 to perform the merge.
    In which file were the merge conflicts created?
  • README.md
  • Correct.
  • ONBOARDING.md
  • Check the hint.
  • INSTALL.md
  • Check the hint.
  • LICENSE.md
  • Check the hint.
  • CONTRIBUTING.md
  • Check the hint.
Hint.
The file containing the conflicts should have opened in the editor automatically when you performed the git merge operation.
(b)
    How many merge conflicts were created?
  • 1
  • Correct.
  • 2
  • Check the hint.
  • 3
  • Check the hint.
  • More than 3.
  • Check the hint.
Hint.
Examine the README.md file that opened when you performed the merge operation. Look for places where raw merge conflict information appears.

5.

Choose and order the steps below to describe the sequence of things that you will do to resolve the merge conflicts that were created.
You have attempted 1 of 7 activities on this page.