Session 3: First steps with Git

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

Course at University of Hamburg

Slides | Source

License: CC BY 4.0 DOI

April 22 2024 (12:15 pm)

Schedule

No Date Title Contents Reading Survey/Quiz
1 2024-04-08 Introduction to version control Organisational matters
Overview of seminar sessions
Introduction to version control
Introduction to Git and its advantages
Intro to version control Course introduction Survey
2 2024-04-15 Command line File Systems
Benefits of the Command Line
Basic Command Line commands
Command Line Command Line Quiz
3 2024-04-22 Setup + Git Fundamentals Installation and configuration of Git
Initializing a Git repository
Basic Git commands
Installation, Setup, First steps with Git Installation Survey, Git Basics Quiz
4 2024-04-29 Basic Git workflow Practicing basic Git commands
Ignoring files with .gitignore
Good commit messages
First steps with Git Git Basics Quiz
5 2024-05-06 Git Branching and Merging Understanding branches in Git
Creating and switching between branches
Merging branches
Resolving merge conflicts
Branches Git Branches Quiz
6 2024-05-13 Quarto Workshop Introduction to Quarto
7 2024-05-20 Whit Monday Cancelled
8 2024-05-27 Introduction to GitHub Introduction to remote repositories
Creating a GitHub account
Creating and managing repositories on GitHub
Pushing and pulling changes
GitHub Intro GitHub Quiz
9 2024-06-03 GitHub with collaborators Cloning a remote repository
Branching and merging in a collaborative environment
Pull Requests
GitHub Issues
Graphical User Interfaces (GUIs), e.g., GitKraken
GitHub Intro, GitHub Issues GitHub Quiz
10 2024-06-10 GitHub with the world Forking a remote repository
README files
Project Management
GitHub Intro, GitHub Issues GitHub Quiz
11 2024-06-17 Repetition and Practice Repetition and Practice
12 2024-06-24 Publishing Creating Tags with Git
Creating Releases with GitHub
Using Zenodo for scientific publishing
Licences
Citation Files
Tags and Releases
13 2024-07-01 Graphical User Interfaces (cancelled) Repetition and Practice
Introduction to using GUIs
Graphical User Interfaces
14 2024-07-08 Summary & Wrap-Up Course evaluation
Repetition and Practice
Introduction to using GUIs
Graphical User Interfaces

1 Last week: The command line

Last week: The command line

Source: Wikimedia Commons (free license)

Last week’s learning objectives

After the last session, you should now be able to answer the following questions / do the following:

💡 You can navigate directories using the command line
💡 You can use shortcuts like the tilde or dots to navigate your file system
💡 You can explain the difference between absolute and relative paths
💡 You can use arguments and flags to modify command-line commands
💡 You understand the concept of wild cards (*) and can use it for system navigation

recipes project

At the end of last week’s session, you should have accomplished the following:

  1. You used the command line to create a folder on your computer called recipes.
  2. You used the command line to create a file called recipes.txt inside the recipes folder.

Please keep the recipes folder! We will continue to use it in the following sessions.

Command Line Quiz Results

2 This week: First steps with Git

Today’s chapter

lennartwittkuhn.com/version-control-book/chapters/first-steps-git.html

This and next week’s learning objectives

Setup

💡 You know how to set up Git for the first time
💡 You have set up Git on your computer
💡 You understand the difference between the three Git configuration levels
💡 You know how to configure your username and email address in Git
💡 You have set up your preferred text editor when working with Git
💡 You can escape the command-line text editor Vim

First steps with Git

💡 You can initialize a Git repository
💡 You can stage and commit changes
💡 You know how to explore the commit history
💡 You can compare different commits
💡 You know how to use and create a .gitignore file
💡 You can discuss which files can (not) be tracked well with Git and why
💡 You know how to track empty folders in Git repositories

Note: These are the learning objectives for this and next week.

Your turn

  1. Content Review: Read the chapters “Setup” and “First steps with Git” in the Version Control Book
  2. Implementation: Try out the commands in the chapter! Play around! Have fun!
  3. Note: We will do the implementation exercises in class together, step-by-step.

Ask questions!

Let’s git started!

Implementation exercises

📝 Set your Git username and email address.
📝 Change the default name of the initial “branch”.
🚀 Optional: Change your default text editor.

📝 Setup: Create a recipes folder and turn it into a Git repository.
📝 Add Content: Write down a short recipe (any favorite or an intriguing AI-generated one) in recipes.txt.
📝 Save Changes: Stage and commit your changes to the repository.

Note: There are several terms in these instructions that might still be unfamiliar to you, for example “repository”, “stage” or “commit”. Don’t worry, you will learn about what these terms mean in the chapters.