Lecture 5: Version Control

DSCI 100

🏠 Housekeeping: Project

  • If you completed your tutorials and worksheets in time but received a grade of 0 and believe this is an error, please email Julia at
  • The course project starts this week!
  • No tutorial assignment on version control this week.
  • Instead, work on your project and complete up to Checkpoint A, and you must submit your repository URL to Canvas!

🏠 Housekeeping: Midterm

Important

  • Bring a laptop. The Lockdown Browser does not work on an iPad or phone.
  • Bring your UBC ID card, we will check it during the midterm.
  • No AI-glasses or any camera, microphone, recording or communication devices allowed!
  • Midterm is 2 weeks from now, during your own tutorial time slot, starting at the beginning of the tutorial period.
  • Closed book quiz on Canvas.
  • You get a reference sheet of R functions. Practise with it now, so you know where everything is.
  • You need to install the Lockdown Browser. More information to come.
  • Test out the lockdown browser on Canvas by completing the iphone_poll quiz.

Tutorial 1 and 2: common mistakes

🚨 Relationship between two variables: needs both direction and strength

  • Direction is the tilt. Strength is how closely the points hug that tilt. An answer needs both.
  • For “no relationship”, we do not say if it’s “strong” or “weak”.
  • Points can follow a curve instead of a straight tilt: a non-linear relationship. Draw a curve for it, not a straight line.

🚨 Which variable goes on the y axis?

Our goal is to determine if there is a relationship between temperature and the number of people renting bikes.

  • Which one could be influencing the other? Warm weather changes how many people rent a bike. The riders cannot change the weather.
  • So the question is really: how does the number of rentals change as the temperature rises?
  • The variable we want to see the effect on goes on the y axis. Rentals on y, temperature on x.

🚨 Read the question description carefully

  • Two questions, and the second one sits below the code hint. Count the question marks before you move on.
  • Write your answer in the designated answer box.

🚨 Correlation does not imply causation

Just because two things happen at the same time does not mean one causes the other.

Week 5: Version control

What is version control?

  • Version control: the process of keeping a record of changes to documents, including when the changes were made and who made them
  • lets you view earlier versions and revert changes
  • facilitates resolving conflicting edits
  • originally for software development, but is now used for many tasks (e.g. data analysis!)

Why do we need tools to help us collaborate?

No big deal. Just send files to your teammates in emails. Right?

Why do we need tools to help us collaborate?

Problems with emailing as version control:

  • which version is the newest?

  • who made edits, when where they made?

  • what were you working on? (when you revisit the project 3 months from now)

  • can’t easily revert changes (if something breaks)

  • no sane way to discuss todo items, issues, etc.

Why do we need tools to help us collaborate?

OK, fine. Then let’s just share and edit files on dropbox/google drive. Right?

These solve only the problem of knowing which version is the newest

Still:

  • can’t tell who made edits, when they were made

  • can’t tell what you were working on when you revisit the project 3 months from now

  • can’t easily revert changes

  • no sane way to discuss todo items, issues, etc

(and honestly, you still usually end up with final_revision_v3_final.docx…)

Git and GitHub

In this course we use two major tools for version control

Git

Git is a version control system that:

  • Keeps track of files in a repository (a folder that you tell Git to pay attention to)

  • Tracks of changes

  • Shares files with others

  • Handles conflict resolution

  • Runs on your (and your teammates’) local machines (collaboration)

GitHub

GitHub is a cloud-based service that hosts your repository which:

  • Helps manage permissions (who can view your project, who can edit it)

  • Provides tools for project-specific communication (organized into issues)

  • Can be used to build and host websites/blogs

📸 add, commit, push, pull

Key version control concepts and commands

Notes:

Key version control concepts and commands

Notes:

Key version control concepts and commands

Notes:

Key version control concepts and commands

Notes:

Key version control concepts and commands

Notes:

Key version control concepts and commands

Notes:

Key version control concepts and commands

Notes:

📸 Where your work lives

⏪ Time travel through your history

Three months later, your plot looks wrong. With lazy messages, which commit do you go back to?

Git clone: create a local copy of the remote repository on GitHub

Before you can add, commit, push or pull, you need the repository on your computer.

  • clone: copy a repository from GitHub to your computer, with its full history and the address of GitHub.
  • Do it once per computer. After that, use pull to get new snapshots.
  • ⚠️ Download ZIP is not the same: you get the files, but no history and no link back to GitHub, so you can’t push.

📋 Your course project

Here are the instructions for the course project: Course Project, also in the menu at the top of this site.

Demo time!

Let’s get a repository made for our projects. Follow along!

📅 Upcoming Due Dates

  • worksheet_version_control due SATURDAY, Oct 10, 11:59pm
  • Project up to Checkpoint A due SATURDAY, Oct 10, 11:59pm
  • No tutorial assignment this week

Important

  • You must submit your repository URL to Canvas!
  • Test out the Lockdown Browser on Canvas by completing the iphone_poll quiz.