Learning Goal

  • Familiarize with the main tools of version control with git using RStudio’s graphical user interface.
  • Practice creating a new project with RStudio GUI.

Learning Objectives

Following this lesson, students will be able to:

  • Explain what is version control and why should we use it in research
  • Use Rstudio to:
    • create a new git repository locally
    • understand the concepts of “staging” and “committing” file versions
    • explain what is a hash
    • display, read and comprehend the git history

Day 1

Intro to git (40 min)

Configuring git (on the terminal, 20 min)

Creating a repository on the terminal

Tracking changes on the terminal

Using git on Rstudio (20 min)

A minute feedback for class 7

  1. Do the following exercise, (either using the Rstudio GUI or the command line, from the terminal):
    1. Create a new RStudio project on your computer called “bio”.
    2. Write a three-line biography for yourself in a file called me.txt, add and commit your changes.
    3. Modify one line, add a fourth line, add and commit the changes.
    4. Display the git history of your project. Describe the differences between the updated state and the original state of your repository. Do your commit messages are informative enough to describe the differences?
  2. Read “best practices for commit messages”
    • Make a summary that lists 3 characteristics of a good commit message.


Day 2

Learning Goals

  • Learn git tools for version control of remote repositories on GitHub
  • Practice usage of Unix shell commands to set up and do remote version control on GitHub

Learning Objectives

Following this lesson, students will be able to:

  • Explain the difference between a local and a remote git repository
  • Create a new repository on GitHub
  • Set up git for usage with GitHub
  • push and pull changes to a remote repository
  • List alternative software to git for version control
  • List other platforms for remote version control with git
  • Explain why we use Git

Introduction

Other software for version control (10 min)

Remote version control with git

Group activity

Cloning repositories (20 min)

git clone Link

git push Link

github fork Link

Activity

A difference between fetching and pulling.

Comic by Allison Hurst

Individual activity

  1. Create a remote repository called “bio” on your GitHub account.
  2. Add, commit and push your local repository to your newly created remote on GitHub.
  3. Add a line to your bio file using the GitHub GUI, and commit it.
  4. Modify another line of your bio on the GitHub GUI and commit it.
  5. Find the commit history on GitHub.
  6. Take a snapshot of the commit history displayed on GitHub and send it to your instructor.
  7. Now pull the changes into your local repository.
  8. Get your commit history on the terminal with git log, take a snapshot of it and send it to your instructor.

A minute feedback for class 8