In this lab, we will learn how to use GitHub for collaborative development.

library(tidyverse)

Goal: by the end of this lab, you will be able to push and pull from GitHub.

GitHub

Use the Projects tab in RStudio to switch to your Mini-Project #2 project.

Checking your remote

First, we want to verify that our local git repository is properly connected to the remote git repository host on GitHub. To do this, we’re going to use the Terminal tab. This is next to the Console tab in the bottom right. Note that you will need the latest version of RStudio in order to use the Terminal tab. If you don’t have a Terminal tab, you should upgrade your RStudio by clicking on Help -> Check for Updates.

To see the remote repository, type in the Terminal:

git remote -v

You should see the URL to your group’s repository. If not, you’ll have to change your remote.

  1. Verify that your remote URL is correct.

Pull

Next, we want to make sure that our local repository is synced with what is on GitHub. To do this, click the Pull (downarrow) button under the Git tab in the upper right pane.

Alternatively, you can do this in the terminal by typing:

git pull

You do NOT need to do both!

  1. Perfom a pull operation.

Committing a change

  1. Make any change to the mp2.Rmd document. Save the document

  2. Stage your modified files by checking the box next to the blue M in the Git tab.

  3. Commit your changes by clicking on the Commit button. Write an informative commit message, and commit your changes.

Pushing

  1. Just to be safe, pull again to bring down any upstream changes.

  2. Push your commit to GitHub.

Check on GitHub

  1. Go to your project’s repository on GitHub and click on Commits. Verify that your commit is shown.

Your learning

Please respond to the following prompt on Slack in the #help-github channel.

Prompt: What further questions do you have about using GitHub?