Resources
Part 1: Git — Version Control

Git tracks changes to your files over time. Think of it as a detailed undo history for your entire project, shared with collaborators.

Configure Git

bash
$ git --version
$ git config --global user.name "Your Name"
$ git config --global user.email "youremail@gmail.com"
$ git config --global core.editor "nano -w"
$ git config --list      # verify your settings

Create a Local Repository

bash
$ cd ~/Desktop
$ mkdir example-repo
$ cd example-repo
$ git init            # initialize a new repo
$ ls -la              # notice the hidden .git folder
$ git status          # always a safe first command
Don't nest repos

Never run git init inside a directory that's already a git repository. This causes confusing problems.

The Git Workflow

Three stages: Working Directory → Staging Area → Repository

Follow this order every time:

bash
git status           # check what's changed
git pull             # get latest changes from remote (when applicable)
git add file.txt     # stage a file (or: git add -A for everything)
git commit -m "message"   # save to the repository with a message
git push             # send to remote (GitHub)

Add and Commit Files

bash
$ cp ~/Desktop/shell-lesson-data/exercise-data/alkanes/middle.sh .
$ cp ~/Desktop/shell-lesson-data/exercise-data/alkanes/*.pdb .
$ cp ~/Desktop/shell-lesson-data/exercise-data/alkanes/sorted.sh .

$ git status
$ git add -A
$ git status
$ git commit -m "added first scripts and data files"
$ touch another_file.txt
$ git status
Exercise 1

Create a new file using any method you've learned. Add it to the repo and commit it.

Viewing History and Reverting
bash
$ nano sorted.sh          # deliberately mess up the script
$ git add -A
$ git commit -m "added function to sorted.sh"

# Oh no — the script is broken. Revert it.
$ git checkout HEAD~1 sorted.sh   # restore previous version
$ less sorted.sh
$ git status
$ git add -A
$ git commit -m "revert to old sorted.sh"
$ git log --oneline               # see compact history
.gitignore

Not everything should be tracked. Large data files, binary outputs, and temporary files waste space and slow down your repo.

bash
$ nano .gitignore
bash
*.pdb
bash
$ git status
$ git add -A
$ git commit -m "add .gitignore"
$ git rm --cached *.pdb     # untrack already-tracked files
$ git commit -m "remove .pdb files from tracking"
Best practice

Create your .gitignore before you start adding files. It's much harder to untrack files after the fact.

git diff and Remote Repos
bash
$ nano sorted.sh       # make a change
$ git diff             # see exactly what changed
$ git add sorted.sh
$ git commit -m "updated sorted.sh"
$ git log --oneline

Connecting to GitHub

  1. Go to github.com and create a new repository called creatures_github
  2. Edit the README in the browser and commit — this initializes the remote repo
  3. Clone it to your Desktop
bash
$ cd ~/Desktop
$ git clone [repo SSH link]
$ cd creatures_github
$ cp ../example-repo/*.sh .
$ git pull                          # always pull before pushing
$ git add -A
$ git commit -m "added shell scripts to repo"
$ git push
Ask AI to Explain Git Concepts AI

Git errors and concepts can be confusing at first. AI is great at explaining them in plain language.

Try this prompt when you hit a Git error
I'm learning Git and I got this error message. Can you explain what it means and how to fix it? [paste your error message here] I'm using Git on the command line and I'm trying to [describe what you were doing].
Or ask for concept explanations
I'm learning Git. Can you explain the difference between the working directory, the staging area, and the repository? Use an analogy to make it concrete. Then explain what git add and git commit do in terms of that analogy.
Part 2: Intro to R

Install R and RStudio if you haven't yet — see the link at the top of this page.

RStudio Orientation

Open RStudio. You'll see four panels: Console (bottom left), Environment (top right), Files/Plots (bottom right), and the Script editor (top left — open a new script with File → New File → R Script).

R
getwd()       # where are you?
list.files()  # what files are here?

R as a Calculator

R
1 + 2
10 * 5
sin(1) + 1 * 5

# Named parameters vs. positional
log(5, 10)        # log base 10 of 5
log(5)            # natural log (base e)
log(5, 2.71828)   # same as natural log

# Logical comparisons
1 == 1
1 != 2
1 < 2

Variables

R
x <- 1/40     # <- is the assignment operator in R
x              # print the value

pirate <- 5
PirateHat <- 1
# 1pirate <- 5  # ERROR: can't start a variable name with a number

pirate <- pirate + 1   # modify a variable
rm(pirate, PirateHat)   # remove from environment

R Projects

R Projects keep your work organized. Go to File → New Project → New Directory to create one. The project sets your working directory automatically every time you open it.

R
# Open the Repro_workshop.Rproj file to follow along
# Create a standard project structure
dir.create("plots")
dir.create("rawdata")
dir.create("results")

# Download the gapminder dataset
download.file("https://swcarpentry.github.io/r-novice-gapminder/data/gapminder_data.csv",
              "rawdata/gapminder.csv")