Applied Data Science - Session 4
Europa-Universität Flensburg
2026-10-19
Worth repeating once
Vienna’s confounder inflated the gap. Barcelona’s hid it. Same control, opposite direction.
Today: better ways to share projects, and to work on them in the first place.
Two questions you cannot answer:
How long to find it?
Without a history
You reread everything. You do not know what you changed.
Four lines changed since Thursday. One is the bug:
One character. Six seconds, not two hours.
The rescue
A backup that also knows what changed, and when.
A zip
A link
Version control is a tool that remembers what your project looked like each time you save a version.
A snapshot, not a list of edits.
And it spans the project, not one file.
Where this resides
The history sits in a hidden .git folder in your project folder.
A repository is your project plus its Git history.
Local — your laptop
Where you work. Fast. Offline. Mortal.
Remote — GitHub
Where it survives. Shareable. Visible.
Not synced automatically. You move things across, deliberately.
Up — use_github()
Started on your laptop. Put it on GitHub.
Once per project.
Down — clone
Already on GitHub. Bring it to a laptop.
Once per machine.
A clone is the whole repository — files and history — still connected to GitHub. After that: the same Pull and Push.
RStudio: File → New Project → Version Control → Git, paste the URL.
Not Download ZIP
Files only. No history, no connection — nothing you can ever push.
Four places. Nothing moves between them by itself.
| Pull | bring GitHub’s commits down to you |
| Stage | choose what goes in the next commit |
| Commit | record it, with a message |
| Push | send your commits up to GitHub |
In that order. Every time.
Wednesday, in the library, you committed and pushed. This laptop knows nothing about it.
Pull. The commit copies down to you — GitHub keeps its own.
You write the limits section and save. Git notices: M report1.qmd
Stage. Tick the box — this goes in the next commit.
Commit. It becomes a commit, on your laptop. GitHub knows nothing yet.
Push. It copies up to GitHub — and stays yours.
Every file in your folder is in one of two states:
| Tracked | Git knows it. Every change from now on is recorded. |
| Untracked | Git has never been told to care about it. |
Both were on that last screenshot: M is tracked and changed, ? is untracked.
Nothing is tracked until you stage it once. So — which files should Git watch?
In
.qmddata/.RprojREADME.mdOut
.html_files/.Rhistory.RDataThe decisive question
One question: Can code recreate this file?
After one render:
report1.qmd is the relevant source file.html amd the _files directory are rebuildable rubbishreport1.qmd.gitignoreOne file, one pattern per line:
use_git() writes the bottom three for youWrite .gitignore first
.gitignore is not retroactive. Commit a file, then ignore it — it stays tracked. Forever.
.gitignore should be step oneThe first thing anybody sees when check a repo.
Six lines is enough. But think about your future-you!
Who you are, and proof that you are you. Once per machine.
The token is a password
Shown once. Not recoverable. Never in a .qmd.
Setting a project up is another three lines, once — we do them together in the live coding, and they are on the exercise sheet.
Stage often. Commit when a piece of work is done — not when the clock says so.
Commits are safety anchors
You can always revert every file to the state of the last commit. When using the terminal, you can also go back to the last staged version of a file.
Finish the sentence: “If you apply this commit, it will …”
Be kind to future-you
Messages should help you in six week to find out when you have changed what.
The Terminal is worth it
R-Studio Git integration is super useful. But there is a payoff in learning to use the Terminal.
Push without pulling, and GitHub refuses:
Edits in different places merge by themselves:
Both edits present. Nothing for you to do.
So the habit is cheap
Click Pull first. Almost always, nothing happens.
Same lines, two versions — Git will not guess:
Delete the markers, keep the version you want, commit. That is all it is.
Real, and how professional teams work. No report needs them.
Worked walkthrough in the solution, for whoever wants it.
The Classroom 50 practice assignment
A repository made for you. Accept it, clone it, three commits, push.
Exercise sheet and manual on the session page. Nothing is marked. It exists so problems surface now, and not the night Report 2 is due.
Then session 5 — the grammar of graphics. The first thing in this course you have genuinely never done.
.gitignore firstYour Report 1 is on GitHub. Report 2 starts there.
Applied Data Science 2026 | Session 4