Day 2 - Intro to git

Spring 2023

Smith College

Overview

Timeline

  • git
  • Github
  • git Workflow

Goal

To understand the purpose and application of git and Github

An Aside

Class Network

The Lines are Drawn

git

The Problem

As projects progress, multiple versions of files are created.

(Different versions in time, files with different features, experiments that didn’t work, etc.)

This causes:

  • Confusion as to the most recent file
  • Clutter
  • Difficulty collaborating

What is git

git is a system for version control.

  • Keep track of multiple versions of files
  • Try experiments without messing up your working code
  • Serves as a backup
  • Allows multiple people to work on the same file

Kinda Like Docs History … But Not

How git Works

Why git is so Efficient

Working with git

git on Your Computer

Github

git and Github

Github as Remote Storage

Collaboration on Github

Github as Portfolio

Using git

Key Terms

repo
Repository - the collection of git files that contain your project
commit
To save a checkpoint of your project for future reference
revert
Undo all changes made to a file since the last commit
staged
A file that is preparing to be commited, but has not yet been
push
To ‘push’ files from your local machine onto an internet service
pull
To ‘pull’ files from a remote service onto your machine
merge
To combine two versions of the same file or project
conflict
When two files or set of files have changes that cannot be easily merged
checkout
Load in a previous checkpoint (commit)

git Workflow

In R Studio

The Commit Window

What is a “Good” Commit?

Are related to one topic/task
Good commits tackle one topic or task at a time. Remember, you are creating save points to come back to if something dosen’t work!


Are frequent
The more often you commit, the better able you are to find where something broke. It also means if you do have to roll back changes, you have less work to re-do


Have descriptive commit messages
Your commit messages should be brief, but descriptive of the changes. Think “if I was using a search bar to find this commit, what would I search for?”

git History

Code Along

For Next Time

Topic

R Objects