Session 1: Welcome & Introduction to Version Control

Track, organize and share your work: An introduction to Git for research

Course at Zentralinstitut für Seelische Gesundheit

Slides | Source

License: CC BY 4.0 DOI

Wednesday, 15th of January 2025, 14:00

1 Logistics & Admin

About

Me

🧑‍🔬 Position: Postdoctoral Researcher at the Institute of Psychology at the University of Hamburg

🎓 Education: BSc Psychology & MSc Cognitive Neuroscience (TU Dresden), PhD Cognitive Neuroscience (MPIB)

🔬 Research: I study the role of fast neural memory reactivation (“replay”) in the human brain using fMRI

🔗 Contact: You can connect with me via email, Mastodon, GitHub or LinkedIn

ℹ️ Info: Find out more about my work on my website, Google Scholar and ORCiD

This course

💻 Materials: All materials are available at https://lennartwittkuhn.com/version-control-course-zi-mannheim-2025/

📦 Software: Reproducible materials are built with Quarto and deployed to GitHub Pages using GitHub Actions

Source: Code is available on GitHub at https://github.com/lnnrtwttkhn/version-control-course-zi-mannheim-2025/

🙏 Contact: I am happy for any feedback or suggestions via email or GitHub issues. Thank you!

Course overview

  • Date: Wednesdays, January 2025
  • Time: 14:00 to 16:00
  • Room: Zoom

What will the average session look like?

The course will consist of 6 main sessions (ca. up to 60 minutes each)

  1. Demonstration (up to 15 minutes):
    The instructor introduces the topic and gives a short demonstration of the main Git commands.
  1. Exercises (up to 45 minutes):
    Course participants work on hands-on exercises and assignments.
  1. Reading (in parallel to the exercises; up to 45 minutes):
    Course participants engage with the online learning materials (aka. our “Version Control Book”).
  1. Discussions (up to 10 minutes):
    Course participants and instructor collectively address any questions related to the session’s content.
  1. Quizzes (up to 10 minutes):
    Course participants complete online quizzes to test their knowledge.

Schedule

No Date Time Title Contents Reading Survey/Quiz
1 2025-01-15 14:00 - 14:30 Welcome & Introduction to Version Control Logistics and course admin
Results of course survey
Introduction to version control
Introduction to Git
Introduction to Version Control Course survey
2 2025-01-15 14:30 - 15:30 Basics of the Command Line File systems and navigation
Benefits of the command line
Basic command line commands
Command Line Command Line
3 2025-01-15 15:30 - 16:00 Setup & configuration of Git Setup & configuration of Git Setup, Installation (if needed) Git Installation
4 2025-01-22 14:00 - 15:00 Basics of Git Initializing a Git repository
Fundamental Git commands
Tracking changes wih Git
Practicing basic Git commands
Ignoring files with .gitignore
Good commit messages
First steps with Git, Git Essentials Git Basics Quiz
5 2025-01-22 15:00 - 16:00 Branches, Merging, Merge Conflicts Understanding branches in Git
Creating and switching between branches
Merging branches
Resolving merge conflicts
Branches Git Branches Quiz
6 2025-01-29 14:00 - 15:00 Integration with GitHub / GitLab Introduction to remote repositories
Managing repositories on GitHub / GitLab
Pushing and pulling changes
Cloning a remote repository
Remotes Intro GitHub Quiz
7 2025-01-29 15:00 - 15:45 Collaboration on GitHub / GitLab Forking
Collaboration with GitHub Flow
Pull / Merge Requests
Issues
Project Management
GitHub Advanced, GitHub Issues GitHub Quiz
8 2025-01-29 15:45 - 16:00 Summary & Outlook Summary of course contents
Outlook to more Git topics
Discussing open questions

Course website

https://lennartwittkuhn.com/version-control-course-zi-mannheim-2025/

Version Control Book

https://lennartwittkuhn.com/version-control-book

Quizzes & Surveys

  • We use online surveys to ask you questions and implement exercises or quizzes
  • Implemented in the formr survey framework (open-source, hosted in Germany)

Anonymity & data usage

  • all raw data are kept anonymous and will only be used for research and educational purposes
  • if responses are shared as part of the course, they will be aggregated to ensure anonymity is maintained
  • if you want your data to be deleted, send an email with your personal codeword to Samuel.Sander@zi-mannheim.de. Your codeword is then forwarded to us (without your name) and your data deleted.

Cheatsheets

Example cheatsheet: Basic Git commands

Command Description
git init Initializes a folder as a Git repository
git status Shows Git tracking status of files in the repository
git add Adds file(s) to the staging area
git commit Commits staged files
git commit -m "commit message" Commits staged files with a commit message

Course exercise: Building an online recipes book

https://lennartwittkuhn.com/recipes/

Code of Conduct

During this course, we want to ensure a safe, productive, and welcoming environment for everyone who attends. All participants and speakers are expected to abide by this code of conduct. We do not tolerate any form of discrimination or harassment in any form or by any means. If you experience harassment or hear of any incidents of unacceptable behavior, please reach out to the course instructor, Dr. Lennart Wittkuhn (lennart.wittkuhn@tutanota.com), so that we can take the appropriate action.

Unacceptable behavior is defined as:

  • Harassment, intimidation, or discrimination in any form, verbal abuse of any attendee, speaker, or other person. Examples include, but are not limited to, verbal comments related to gender, sexual orientation, disability, physical appearance, body size, race, religion, national origin, inappropriate use of nudity and/or sexual images in public spaces or in presentations, or threatening or stalking.
  • Disruption of presentations throughout the course. We ask all participants to comply to the instructions of the speaker with regard to dedicated discussion space and time.
  • Participants should not take pictures of any activity in the course room without asking all involved participants for consent and receiving this consent.

A first violation of this code of conduct will result in a warning, and subsequent violations by the same person can result in the immediate removal from the course without further warning. The organizers also reserve the right to prohibit attendance of excluded participants from similar future workshops, courses or meetings they organize.

2 Survey results

🙏 Thank you for your responses!

Expectations

Without copy-pasting the title: What do you think this course is going to be about?

  • Introduction to Git, GitHub, and GitLab.
  • Basics of version control and Git commands (commit, push, pull, branches).
  • Command-line interaction and practical uses.
  • Tips and tricks for effective Git usage.
  • Structuring and organizing research projects with Git.
  • Collaboration and workflow management.

Hopes

What do you hope to learn in this course?

  • Learn how to use GitHub and GitLab in daily work.
  • Get better at using Git and its commands.
  • Understand how to work with branches and fix merge conflicts.
  • Explore new and useful ways to use Git.
  • Use Git to make research and work easier and faster.
  • Improve teamwork and collaboration with Git.
  • Build confidence in using Git for everyday tasks.

Worries

Do you have any worries or fears regarding this course that you want to express?

  • No prior experience or expectations.
  • Some concern about being a beginner and keeping up with others.
  • Hoping the course is not too complicated and suits all experience levels.
  • Looking forward to learning, even as a novice.

Motivation

What is your main motivation for taking this course?

  • Improve Git and version management skills.
  • Close knowledge gaps and become more confident using Git.
  • Use GitHub/GitLab more naturally in research and work.
  • Apply Git skills to analyze data and collaborate effectively.
  • Gain inspiration and new ideas for using Git in work.
  • Benefit from better Git understanding in daily tasks.

Let’s do the splits

3 Introduction to Version Control

Survey: Scenario 1

Imagine a scenario where you crafted a brilliant paragraph for a manuscript (for example, your paper, thesis, or report), but then accidentally ruined it. How would you retrieve the earlier brilliant version? Is it even possible?

  • “Only if I saved it before - otherwise, I’d have to draft another brilliant paragraph.”
  • “I might be able to find it in a cloud backup, like OneDrive or Google Drive.”
  • “Version Control?”
  • “I’d simply revert to the relevant commit.”

Survey: Scenario 2

Consider a situation where you are working with five co-authors on a paper. How do you handle the changes and comments they make to the document? If you’re using LibreOffice Writer or Microsoft Word and you accept changes made using the “Track Changes” option, what happens to the history of those modifications?

  • “I always save new versions of files with my initials (and others’ initials when I receive the document), which often results in having 10–20 different file versions.”
  • “I believe the history of modifications is lost after accepting the changes …”

Learning objectives

At the end of this session, you should be able to answer the following questions and / or achieve the following learning objectives:

💡 You know what version control is.
💡 You can argue why version control is useful (for research).
💡 You can name benefits of Git compared to other approaches to version control.
💡 You can explain the difference between Git and GitHub.

Your turn

In this session, you will work on the following tasks:

  1. Skim the chapter Introduction to Version Control in the Version Control Book.
  2. Check whether you have achieved the learning objectives.

Learning objectives

💡 You know what version control is.
💡 You can argue why version control is useful (for research).
💡 You can name benefits of Git compared to other approaches to version control.
💡 You can explain the difference between Git and GitHub.

4 Discussion

The issue of computational reproducibility in science

“… when the same analysis steps performed on the same dataset consistently produce the same answer.” 1

by Scriberia for The Turing Way Community (2022) (Link, CC BY 4.0)

The problem

  • about more than half of research is not reproducible 2
    • research data, code, software & materials are often not available “upon reasonable [sic] request”
    • if resources are shared, they are often incomplete
  • 90% of researchers: “reproducibility crisis” (N = 1576) 3

Why?

  • computational reproducibility is hard
  • researchers lack training
  • incentives are not (yet) aligned 4
  • more …

… accumulated evidence indicates […] substantial room for improvement with regard to research practices to maximize the efficiency of the research community’s use of the public’s financial investment.(Munafò et al., 2017)

We need a professional toolkit for digital research!

Why we need version control …

… for code (text files) © Jorge Cham (phdcomics.com)

… for data (binary files) © Jorge Cham (phdcomics.com)

When everything is relevant …

… track everything.

What is version control?

“Version control is a systematic approach to record changes made in a […] set of files, over time. This allows you and your collaborators to track the history, see what changed, and recall specific versions later […]” (Turing Way)

keep track of changes in a directory (a “repository”)

take snapshots (“commits”) of your repo at any time

know the history: what was changed when by whom

compare commits and go back to any previous state

work on parallel “branches” & flexibly “merge” them

“push” your repo to a “remote” location & share it

share repos on platforms like GitHub or GitLab

work together on the same files at the same time

others can read, copy, edit and suggest changes

make your repo public and openly share your work

What is Git?

  • most popular version control system
  • free, open-source command-line tool
  • graphical user interfaces exist, e.g., GitKraken
  • standard tool for most (all?) software developers

What is GitHub?

  • cloud-based platform for version control using Git
  • allows for collaboration on coding projects in real time
  • hosts millions of public and private repositories
  • supports both Git command line and GUI tools (e.g., GitHub Desktop)
  • enables code sharing, project management, issue tracking, and continuous integration
  • used by companies, open-source communities, and individual developers worldwide
  • 100 million users 5

More benefits of Git(Hub) for project management

  • Discuss and plan your project in issues (even just with your future / past self)
  • Ask questions, share ideas and discuss with your community via GitHub Discussions
  • Propose changes to each other’s projects using pull requests 6
  • Create a fork of someone else’s repository and extend their work
  • Manage access to your projects with detailed permissions and roles
  • Add documentation to your repository or in a separate wiki
  • Access to more features and tools for teaching via GitHub Campus Global

Note

  • The dominance of GitHub (a for-profit company owned by Microsoft) is not uncontested (see #GiveUpGitHub)
  • A project on GitHub is not a FAIR archiving of scholarly outputs (see previous and following slides)

5 Outlook

Goal

From this …

To this …

Schedule

No Date Time Title Contents Reading Survey/Quiz
1 2025-01-15 14:00 - 14:30 Welcome & Introduction to Version Control Logistics and course admin
Results of course survey
Introduction to version control
Introduction to Git
Introduction to Version Control Course survey
2 2025-01-15 14:30 - 15:30 Basics of the Command Line File systems and navigation
Benefits of the command line
Basic command line commands
Command Line Command Line
3 2025-01-15 15:30 - 16:00 Setup & configuration of Git Setup & configuration of Git Setup, Installation (if needed) Git Installation
4 2025-01-22 14:00 - 15:00 Basics of Git Initializing a Git repository
Fundamental Git commands
Tracking changes wih Git
Practicing basic Git commands
Ignoring files with .gitignore
Good commit messages
First steps with Git, Git Essentials Git Basics Quiz
5 2025-01-22 15:00 - 16:00 Branches, Merging, Merge Conflicts Understanding branches in Git
Creating and switching between branches
Merging branches
Resolving merge conflicts
Branches Git Branches Quiz
6 2025-01-29 14:00 - 15:00 Integration with GitHub / GitLab Introduction to remote repositories
Managing repositories on GitHub / GitLab
Pushing and pulling changes
Cloning a remote repository
Remotes Intro GitHub Quiz
7 2025-01-29 15:00 - 15:45 Collaboration on GitHub / GitLab Forking
Collaboration with GitHub Flow
Pull / Merge Requests
Issues
Project Management
GitHub Advanced, GitHub Issues GitHub Quiz
8 2025-01-29 15:45 - 16:00 Summary & Outlook Summary of course contents
Outlook to more Git topics
Discussing open questions

Next session: The command line

Source: Wikimedia Commons (free license)

References

Baker, M. (2016). 1,500 scientists lift the lid on reproducibility. Nature, 533(7604), 452–454. https://doi.org/10.1038/533452a.
Crüwell, S., Apthorp, D., Baker, B. J., Colling, L., Elson, M., Geiger, S. J., Lobentanzer, S., Monéger, J., Patterson, A., Schwarzkopf, D. S., Zaneva, M., & Brown, N. J. L. (2023). Whats in a Badge? A Computational Reproducibility Investigation of the Open Data Badge Policy in One Issue of Psychological Science. Psychological Science, 34(4), 512–522. https://doi.org/10.1177/09567976221140828.
Hardwicke, T. E., Bohn, M., MacDonald, K., Hembacher, E., Nuijten, M. B., Peloquin, B. N., deMayo, B. E., Long, B., Yoon, E. J., & Frank, M. C. (2021). Analytic reproducibility in articles receiving open data badges at the journal Psychological Science : an observational study. Royal Society Open Science, 8(1). https://doi.org/10.1098/rsos.201494.
Munafò, M. R., Nosek, B. A., Bishop, D. V. M., Button, K. S., Chambers, C. D., Percie du Sert, N., Simonsohn, U., Wagenmakers, E.-J., Ware, J. J., & Ioannidis, J. P. A. (2017). A manifesto for reproducible science. Nature Human Behaviour, 1(1). https://doi.org/10.1038/s41562-016-0021.
Obels, P., Lakens, D., Coles, N. A., Gottfried, J., & Green, S. A. (2020). Analysis of Open Data and Computational Reproducibility in Registered Reports in Psychology. Advances in Methods and Practices in Psychological Science, 3(2), 229–237. https://doi.org/10.1177/2515245920918872.
Poldrack, R. A. (2019). The Costs of Reproducibility. Neuron, 101(1), 11–14. https://doi.org/10.1016/j.neuron.2018.11.030.
The Turing Way Community. (2022). The turing way: A handbook for reproducible, ethical and collaborative research. Zenodo. https://doi.org/10.5281/zenodo.3233853.
Wicherts, J. M., Borsboom, D., Kats, J., & Molenaar, D. (2006). The poor availability of psychological research data for reanalysis. American Psychologist, 61(7), 726–728. https://doi.org/10.1037/0003-066x.61.7.726.

Footnotes

  1. The Turing Way Community (2022), see “Guide on Reproducible Research”

  2. for example, in Psychology: Crüwell et al. (2023); Hardwicke et al. (2021); Obels et al. (2020); Wicherts et al. (2006)

  3. see Baker (2016), Nature

  4. see e.g., Poldrack (2019)

  5. (Source: Wikipedia)

  6. pull requests on GitHub, merge requests on GitLab