GitHub workflows: forks and branches

Setup

Person 1 (owner):

  • Create a repository using the following these instructions steps 1-6

  • Add Person 2 as collaborator following these instructions
  • Edit the README to:
    • Replace the title (first line starting with #) with something better! Maybe Favorite Desserts
    • Add your name and your favorite dessert below the title: e.g. - Julien: crepes
knitr::include_graphics("img/github-readme_desserts.png")

Forks

Person 2: Create a Fork

  • Ask your teammate to Slack you the link to the repository
  • Create a Fork by clicking on the Fork button on the top right view of your repository homepage

  • On your Fork, start editing the README.md

  • Add your name and your favorite dessert below your teammate entry: e.g. - Sophia: chocolate

  • Add a descriptive commit message

knitr::include_graphics("img/github-commit.png")

  • Commit your changes

  • Create a pull request to merge those changes to the main repository using these instructions

Person 1:

  • Go to your repository and merge the PR

Branches

Person 1: add a file

Download this csv file about your favorite desserts to your computer

  • Just drag and drop it on the Github web page of your repository to upload it
  • Add a short message about the file: e.g. Adding dessert csv & hit Commit changes
  • Your file has been uploaded. Click on the filename to see it!

You should have something similar to this repo: https://github.com/brunj7/favorite-desserts/blob/master/favorite_desserts.csv

Now you want to collaborate more closely and do not wan your teammate to have to create a fork and be able to work directly on your repository

  • Add Person 2 as a collaborator following these instructions

Person 2: Create a branch

  • Check your email or Github Notifications to accept the invitation
  • Go to the repository website (link is provided in the invitation)
  • Create a new branch named after your first name
knitr::include_graphics("img/github-create_branch.png")

  • Edit the csv file directly on GitHub to add your favorite dessert to it
  • Create a Pull Request (PR) to merge you branch back to main
  • Assign person 1 as a reviewer (instructions)

Person 1: Merge the branch

  • Review PR
  • Merge and close PR


This work is licensed under CC BY 4.0

UCSB logo