RaukR 2026 • Data Science With R
Nina Norgren
18-Aug-2026
“My code worked yesterday, now it’s broken!”
Revert to a previous version
“I forgot what and why I changed something in the code”
Check the git history
“Several people have done changes to the same code, how do I solve this?”
Let git try to merge it
Git:
GitHub:



Note
Everything git knows lives inside .git/. Delete that folder and you have plain files again; the rest of your project is untouched.
git status - what’s changed, and what’s stagedgit diff - line by line, what exactly changedgit log - the history of commits so farWhen you’re confused, run git status. It almost always tells you the next move.

.Rhistory, .RDataList file patterns that should not be tracked in a file called .gitignore:
# R session junk
.Rhistory
.Rproj.user/
# Rendered output
*_files/
# Data and secrets — keep these out of git!
data/*.csv
Important
.gitignore only stops git from tracking files it isn’t already tracking. Once committed, a file keeps being tracked until you explicitly remove it.
mainmainA branch is just a movable pointer to a commit, nothing more than a 41-byte file.
HEAD is a pointer to the branch you’re currently onBring the work from one branch into another:
main hasn’t moved, git just slides its pointer forward, a fast-forwardIf two branches changed the same lines, git can’t decide, it pauses and asks you:
<<<<<<< HEAD
result <- mean(x)
=======
result <- median(x)
>>>>>>> new-feature
.git folder containing all informationgit initgit add, git commit).gitignore file to prevent git from tracking files (large files, binary, data, junk files)Local versus remote
git already works perfectly well on your own machine. So why use Github?
GitHub doesn’t do anything mysterious. A GitHub repository is just another git repository, hosted on a server you can reach over the internet.
On your laptop
.git/On GitHub
Note
The two are linked by a remote, a saved bookmark to the other copy, conventionally named origin. You keep them in sync by pushing commits up and pulling commits down.
Because both sides are real git repositories, syncing is just moving commits between them:
git push
Send your local commits up to GitHub
git pull
Bring others’ commits down to your laptop
Same pointer model as before, just across two machines: pushing moves GitHub’s branch pointer forward to match yours; pulling moves yours forward to match GitHub’s.
git add and git commit are completely local, They don’t require an internet connectiongit push sends them to GitHubgit is for the work, GitHub is for sharing the work. A normal session uses both:
git clone a repo from GitHub (or push a new local one up)git add → git commit, over and overgit push your commits up to GitHubgit pull to bring in what collaborators pushedSteps 2 are pure git, on your own machine. Steps 1, 3 and 4 are where GitHub comes in.

By convention, the main remote is called origin.
Check that it worked:
GitHub no longer accepts your account password for HTTPS operations.
HTTPS https://github.com/…
Authenticate using a Personal Access Token
Good default for beginners
SSH git@github.com:…
Authenticate using a private key on your computer. The matching public key on GitHub
Convenient after the initial setup
Note
Your GitHub password is still used when signing in to the GitHub website. It just isn’t used by git push over HTTPS.
Positron’s Source Control panel calls the exact same git underneath. Every button maps to a command you already know:
| In Positron | On the command line |
|---|---|
+ next to a file |
git add <file> |
| Type message + Commit | git commit -m "..." |
| Sync / Push | git push / git pull |
| Branch name in status bar | git switch |
| Clicking a changed file | git diff |
The usethis package automates the fiddly bits, all from the R console:
Wraps the same git operations you already know, but conveniently packaged for R users.
Your own GitHub repository, but copied from someone else’s.
When you don’t have permission to push to the original repository
Original repository
(someone else's)
│
Fork
▼
Your repository
Your own GitHub repository, but copied from someone else’s.
When you don’t have permission to push to the original repository
A Pull Request (PR) is a request to merge changes from one branch into another
Your branch (or fork)
│
▼
Open Pull Request
│
▼
Review • Discuss • Test
│
▼
Merge
A Pull Request doesn’t change anything by itself, it just asks someone to review and merge your changes.
| git | local version control |
| GitHub | hosting and collaboration platform for Git repositories |
| add | stage a file for commit |
| commit | commit the staged changes to the local repository |
| push | send your local commits to the remote repository |
| pull | bring commits from the remote repository to your local repository |
| Branch | “copy” where you can test out new ideas |
| Fork | your own copy of someone else’s repository |
| Pull Request | request to merge your changes into a branch |
git <command> --help — the built-in manual for any commandYou won’t remember every command today, and you don’t need to. Remember the basics and look the rest up.