• Home
  • About
  • Schedule
  • Sessions
  • Team
  • Mechanics
  • Repos
  • Code of Conduct
  • Acknowledgements

Contents

  • This session
  • Learning objectives
    • Setup
    • First steps with Git
  • city-guide project
  • Exercises
    • Configure Git
    • Initialize a Git repository
    • Add content and commit changes
  • Slides
  • Cheatsheet
    • Setup
    • First steps with Git

First steps with Git

Session 03

Starts at:

November 01 2024 (10:15 am)

Slides Chapter: Installation Chapter: Setup Chapter: First steps with Git Survey: Installation

This session

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

  1. Reading: Read the chapter(s) “Setup” and “First steps with Git” in the Version Control Book.
  2. Implementation: Try out the commands in the chapter.
  3. Exercises: Work on the exercises for the city-guide project.
  4. Quiz: Test your knowledge with the quiz.

As always:

  1. Try out the commands of this session and play around with them.
  2. Check whether you have achieved the learning objectives.
  3. Ask questions!
  4. Let’s git started!

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 check the status of a Git repository.
💡 You understand the difference between the staging area and a commit.
💡 You can stage and commit changes.
💡 You understand the difference between a commit message and a description.

city-guide project

At the end of this session, you should have accomplished the following:

  1. You set up Git.
  2. You initialized your city-guide folder as a Git repository.
  3. You committed your first file to the city-guide repository.

Please keep the city-guide folder! We will continue to use it in the following sessions.

Exercises

Configure Git

  1. If needed, navigate into the project folder using the command line.
  2. Set your Git username.
  3. Set your Git email address.
  4. Change the default name of the initial branch to main
  5. 🚀 Optional: Change your default text editor.
  6. List the Git configuration settings.

Initialize a Git repository

  1. If needed, navigate to the project folder using the command line.
  2. Initialize a new Git repository in the project folder.

Add content and commit changes

  1. Create a new text file and name it appropriately.
  2. Add a short entry to the text file (any favorite or an intriguing AI-generated one).
  3. Stage the new file.
  4. Commit the changes in the text file with a descriptive commit message.

🚀 Optional: Commit at least three additional changes in your new file.

Slides

How can I download the slides as PDF?

To print the slides to PDF, do the following:

  1. Toggle into Print View using the E key (or using the Navigation Menu).
  2. Open the in-browser print dialog (CTRL/CMD+P).
  3. Change the Destination setting to Save as PDF.
  4. Change the Layout to Landscape.
  5. Change the Margins to None.
  6. Enable the Background graphics option.
  7. Click Save.

Note: This feature has been confirmed to work in Google Chrome, Chromium as well as in Firefox.

Here’s what the Chrome print dialog would look like with these settings enabled:

Screenshot of Chrome print dialog with the first slide/page of 43 shown on the left, and print options on the right. The Destination print option has Save as PDF selected.

These instructions were copied from the Quarto documentation (MIT License) and slightly modified.

Cheatsheet

Setup

Command Description
git config Get an overview of Git config commands
git config --global user.name "user.name" Sets Git username
git config --global user.email "user.email" Sets Git email address
git config --global core.editor "editorname" Sets Git text editor
git config --global init.defaultBranch main Sets default branch name to main
git config --list Views set Git configurations

First steps with Git

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
© 2024 – 2025 Dr. Lennart Wittkuhn
  • Acknowledgements
License: CC BY 4.0