Working together on GitHub · lesson 7 of 7
Commands and ideas in this lesson
Agit remote add, git push -ufrom lesson 4.8
BPull requestsfrom lesson 5.2
Cgit fetch, git pullfrom lesson 4.6
DConflictsfrom lesson 3.4

Kusina: Carla joins

Last updated

Ana's cousin Carla wants to help type up Lola Remy's notebook. In this project you'll put Kusina on the hosting site, review and merge Carla's first pull request, and then settle her second one, which clashes with a change you made yourself.

By the end of this lesson you can

  • Put an existing repository on a host and push it
  • Review and merge a teammate's pull request
  • Settle a pull request's conflict by merging main into its branch

The brief

You're Ana, in kusina. The family wants a fresh shared copy of Kusina for Carla to join, and an empty repository is waiting on the host.

  1. Connect Kusina to it as origin and push main. As soon as you do, Carla clones it and opens a pull request.
  2. Review Carla's pull request #1: read the recipe, comment, approve, merge. Pull it into your main.
  3. Carla then opens #2, changing the salt in the adobo to 2 tsp. Before you look at it, Lola Remy phones you: 1 1/2 tsp. Change the adobo on your main to say that, commit and push.
  4. Now #2 can't be merged: it conflicts with your change. Call Lola back: she settles on 2 tsp after all. Fetch, switch to Carla's branch adobo-salt, merge main into it, settle the conflict, commit and push. Then merge #2 on the host, and pull.

Build it

Git sandbox
  1. Kusina on the host, with main pushed
  2. Pull request #1 reviewed and approved
  3. #1 merged, and in your main
  4. Your 1 1/2 tsp change pushed to main
  5. Carla’s branch with main merged in and the conflict settled, pushed
  6. #2 merged on the host, and pulled into your main

Working folder

no changes

Staging area

nothing staged

Repository

10 commits on main

You are in ~/kusina. An empty repository is waiting on the hosting site at https://example.com/ana/kusina.git.

Commit graph

  1. 67e435d HEAD →main Cover the leche flan with foil
  2. ba04ca2 Add lumpiang shanghai recipe
  3. 98a5edc Add a script that builds the index page
  4. d078487 Make the sinigang steps clearer
  5. 145dc1e Add pancit bihon recipe
  6. 52d1f4d Say how much salt goes in the adobo
  7. 1c17fad Add a README
  8. 9c53888 Add leche flan recipe
  9. 1f359a2 Add sinigang recipe
  10. 601c654 Add adobo recipe

On the hosting site: example.com/ana/kusina

Branches: none yet

If the host says "This branch has conflicts that must be resolved", that's step 4 of the brief. Hosts can also settle simple conflicts on the site; doing it in your own copy works everywhere and lets you test the result.

Spot the trap: approving without reading

Spot the trapAna

Carla’s pull request is titled “Add kare-kare recipe”. Ana is busy. She clicks Approve and Merge without opening Files changed.

What happens if…

Check your history

Run git log --oneline --graph -8. You should see Carla's kare-kare arriving through the first merge commit, and a second loop where her salt branch, with your main merged into it, joins main.

Why did merging main into Carla’s branch settle the pull request’s conflict?
Who should press Merge on a pull request in a team?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git