Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Using Git to track, organise and share your SDS320 project

1. Why Git matters

Git helps you track how your SDS320 project changes over time. This is useful for backup, documentation, transparency and Reproducibility.

Your final project should include a public GitHub or GitLab Repository. The repository should make it possible for another student to understand what you did, which files matter, how your workflow is organised and how the main results can be reproduced.

This page gives you a practical Git refresher for SDS320. It focuses on the basic workflow you need during the semester. For detailed expectations about the final project repository, see Repository.


2. The basic idea

Git records snapshots of your project. These snapshots are called commits.

A Git workflow usually follows this pattern:

work on files
→ check what changed
→ stage selected changes
→ commit with a message
→ push to the online repository

In SDS320, Git is not only a technical tool. It also helps you show project development. Your commit history can document when you added data notes, tested preprocessing, improved figures, fixed path problems or updated your report.


3. Key Git concepts

Repository

A repository is a project folder tracked by Git. It usually contains notebooks, scripts, documentation, environment information and selected outputs.

In SDS320, your assessed project repository should be understandable to someone who did not sit next to you while you worked.

Commit

A commit is a saved snapshot of selected changes. A good commit should represent one meaningful step, not a random collection of unrelated edits.

Examples of useful commit moments:

Staging

Staging means selecting which changed files should go into the next commit. This lets you commit related changes together.

Remote repository

A remote repository is the online version of your project, for example on GitHub or GitLab.

Your local repository lives on your computer. The remote repository makes it possible to back up, share and submit your work.


Use this workflow regularly while working on your project.

1. Check what changed

Run this inside your project folder:

git status

This shows which files were changed, added or deleted.

2. Stage meaningful files

To stage all current changes:

git add .

For more controlled commits, stage selected files:

git add README.md
git add notebooks/01_explore_data.ipynb
git add scripts/preprocessing.py

3. Commit with a clear message

git commit -m "Add initial data inventory"

A good commit message describes the change clearly.

4. Push to the remote repository

git push

This uploads your committed changes to the online repository.

5. Pull before continuing on another machine

If you work on more than one computer, update your local copy first:

git pull

This downloads changes from the remote repository.


5. Starting a repository

There are two common ways to start.

Option A: start online first

This is often easiest for beginners.

  1. Create a new repository on GitHub or GitLab.

  2. Copy the repository URL.

  3. Clone it to your computer:

git clone <repository-url>
  1. Move into the folder:

cd <repository-folder>
  1. Add or copy your SDS320 project files into this folder.

Option B: start locally first

If you already have a local project folder, open a terminal in that folder and run:

git init

Then connect it to an online repository later.


6. Using Git in VS Code

You can use Git from the Command Line, but many students find the VS Code interface easier for everyday work.

VS Code has a Source Control view that lets you inspect changes, stage files, write commit messages, commit changes and sync with a remote repository. It still uses the Git installation on your computer, so git --version must work first.

A. Open the right folder

Open the full project folder in VS Code, for example:

sds320/project/

Do not open only a single notebook. Opening the full folder lets VS Code detect the repository, show changed files and manage relative paths more clearly.

B. Use the Source Control view

In VS Code:

  1. open the Source Control view in the left sidebar,

  2. inspect the list of changed files,

  3. click a file to see what changed,

  4. stage the files that belong together,

  5. write a short commit message,

  6. commit the changes,

  7. sync or push the commit to GitHub/GitLab.

If you use GitHub, install the official GitHub Pull Requests and Issues extension.

From the VS Code Extensions panel, search for:

GitHub Pull Requests and Issues

Or install it from the terminal:

code --install-extension GitHub.vscode-pull-request-github

This extension is useful when you want to review changes, manage pull requests or connect issues to code. For a simple individual SDS320 project, the built-in Source Control view is usually enough.

D. Using VS Code vs. the terminal

TaskVS Code is useful forTerminal is useful for
Checking changed filesSeeing file-by-file differencesRunning git status quickly
Staging changesSelecting files visuallyStaging with git add
Writing commitsWriting messages in the Source Control panelCommitting with git commit -m
Pushing and pullingUsing the Sync buttonRunning git push and git pull
Debugging Git problemsSeeing visual warningsCopying exact error messages

You can use both. The important part is that you understand the basic workflow: check, stage, commit, push.


7. Repository contents

What should go into your repository

Your SDS320 repository should usually include:

The repository should make your workflow understandable and rerunnable.

For more detailed expectations, see Repository.


What should not go into your repository

Avoid committing:

Use a Gitignore File to exclude files that should not be tracked.

Example .gitignore:

# system files
.DS_Store
Thumbs.db

# Python
__pycache__/
*.pyc

# environments
.venv/
.env

# large/local data
data/raw/
data/interim/

# temporary outputs
*.tmp

8. Good commit messages

Useful commit messages are short and specific.

Less usefulMore useful
updateAdd first data inventory
fixFix CRS mismatch in preprocessing notebook
stuffAdd repository structure and README draft
finalAdd final figures and report link

A good commit message helps you and others understand the project history.

Use this pattern when you are unsure:

Verb + object + context

Examples:

Add preprocessing notebook
Fix broken relative paths
Update README with data source notes
Save first evaluation figure
Document model limitation

9. Flags & checks

Use this table when your Git workflow becomes confusing. Start with the first check before changing many things at once.

Red flagFirst check
You have not committed for several weeksMake one small commit now, then commit after each meaningful project step.
Your Git history has only one final commitCommit smaller project steps, such as data inventory, preprocessing, figures or README updates.
git status shows many unrelated changesStage and commit related files separately instead of using one large mixed commit.
Your repository contains large raw dataAdd or update .gitignore; document data sources and download steps in data/README.md.
Your project only works on your computerCheck for Absolute Path values and replace them with Relative Path values.
Your remote repository is missing recent local workCommit your changes, then run git push.
Your local folder is behind the remote repositoryRun git pull before continuing, especially when working on another computer.
VS Code does not show Source Control changesCheck that you opened the full repository folder, not only one file or notebook.
Git asks who you areConfigure your Git username and email before committing.
You see a merge conflictPause, read the conflict markers, compare both versions and ask for help if unsure.
Your README is still empty or too vagueAdd a project title, research question, data note, setup instructions and run order.
A script or notebook is required but not explainedMention it in the README and describe when to run it.
You are unsure what will be committedUse git status and the VS Code diff view before committing.
You committed a file that should not be trackedStop and ask for help before trying to remove sensitive data from Git history.

For technical problems, see Troubleshooting.


10. Mini task

Work inside your SDS320 project folder.

Complete this checklist:

Example terminal workflow:

git status
git add README.md environment.yml .gitignore
git commit -m "Add initial project documentation files"
git push

Write one sentence in your project notes:

My next useful Git commit will be: ...

11. Key takeaways


What to do next

After this page: