GitHub Collaboration

Projected Time

About 1 hour

Prerequisite

Motivation

-In the industry, apps are created by teams of developers rather than individual people. Proper use of GitHub for collaboration minimizes code conflicts and helps teams work together.

Who uses GitHub: As of August 2019, more than 40 million people use GitHub. Some popular companies are Facebook, Google and Microsoft.

Looking at an example repository If you have checked a repository before, you might have noticed it says Branch: main or Branch: master right under the tabs and metadata. That button can be used to switch and subsequently check various branches.

A note about “master” branches In 2020, Techtonica/curriculum renamed its default branch from master to main. We chose to do this because we do not to wish to draw on the legacy of master/slave language. For more details, see Gnome archive. Be aware of this while navigating new repos, and check the readme if you are unsure which is their default branch. Although the dev community seems to have agreed on “main”, other alternative names include: “trunk”, “release”, “prod”, “production”, “live”, “default”, “head”, “primary”, and “top”.

Objectives

Participants will be able to:

Specific Things to Learn

Supplemental Materials

Lesson

Things to Remember

Guided Practice

  1. Fork a GitHub repo
    git clone https://github.com/mygithubhandle/curriculum.git
    Press enter.
  2. Contribute to the project
  3. Commit and push your changes.
  4. Make a Pull Request to Techtonica/curriculum.
  5. Make a Pull Request to your partnersGitHubHandle/curriculum main branch.
  6. Practice merging
  7. Practice pulling
    git status
    git add practice/apprentices.md
    git commit -m "resolve merge conflicts"
    git push origin main
  8. Adding a new remote repo(from atlassian.com)

Challenge

Make another PR by checking out a new branch

  1. git pull techtonica main again. Fix any merge conflicts and commit.
  2. Enter git checkout -b middle-name to create a new branch.
  3. In practice/students.md, give yourself a cool nickname with quotes, ex: Margot “Danger” Tenenbaum
  4. git pull techtonica main again before pushing your new changes, just in case someone else made a commit in the time it took to do your work. (In real life, you will likely be working on a change for hours or days.)
  5. git status, add, commit, push, and make a PR for your middle-name branch to merge into the Techtonica/curriculum main branch.
  6. Ask someone to review your PR. This time, they should request changes with some bogus message, submit your review, and let you see it before resolving it and approving the PR after all.
  7. Fix any conflicts and merge the changes.
  8. Congrats, your cool nickname should be in the Techtonica/curriculum main branch!

Check for Understanding