• Home
  • About
  • Schedule
  • Sessions
  • Code of Conduct

Contents

  • This session
  • Learning objectives
  • recipes project
    • Optional:
  • Exercises
    • 1. Upload and manage your repository on MPIB GitLab or GitHub
      • Connect to MPIB GitLab or GitHub
      • “Push” your repository
    • 2. “Private” collaboration with pull requests (using “GitHub Flow”)
    • 🚀 Optional: Create a README.md file
    • 🚀 Optional: Manage branches
    • 🚀 Optional: Clean up your repository on MPIB GitLab or GitHub
    • 🚀 Optional: Clone and sync your repo
  • Slides
  • Cheatsheet

Integration with GitLab / GitHub

Session 06

Starts at:

14:00

Slides Chapter: Remotes - Introduction Quiz

This session

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

  1. Reading: Read the chapter “Remotes - Introduction” in the Version Control Book.
  2. Implementation: Try out the commands in the chapter.
  3. Exercises: Work on the exercises for the recipes 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

💡 You can connect your local Git to a remote repository service.
💡 You can create a remote repository.
💡 You can pull and push changes to and from a remote repository.

recipes project

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

  1. You connected your GitHub account to your local Git.
  2. You created a new GitHub repository and uploaded (i.e., “pushed”) your recipes project.
  3. You collaborated on a shared project by adding and committing changes to a partner’s repository.
  4. You created and reviewed a pull request to integrate new content from a partner.

Optional:

  1. You cleaned up your project by deleting unnecessary files and branches.
  2. You created a short README.md file in your repository.

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

Exercises

1. Upload and manage your repository on MPIB GitLab or GitHub

Connect to MPIB GitLab or GitHub

  1. Generate a personal access token (PAT) on GitHub.
  2. Use the PAT for GitHub authentication.

“Push” your repository

  1. Create an empty internal repository on MPIB GitLab or private repository on GitHub.
  2. Set the remote URL for your local recipes Git repository.
  3. Push your main branch to MPIB GitLab or GitHub.

2. “Private” collaboration with pull requests (using “GitHub Flow”)

  1. Add your partner (desk neighbor) as a collaborator to your recipes repository.
  2. Clone your partner’s repository.
  3. Create a new branch in your partner’s repository.
  4. Add and commit a recipe to your partner’s recipes.txt file.
  5. Push the changes on the new branch to MPIB GitLab / GitHub.
  6. Create a Merge Request / Pull Request.
  7. Review and merge the PR your partner made in your repository.
  8. 🚀 Optional: Add additional changes on the branch pushed by your collaborator.

🚀 Optional: Create a README.md file

  1. Navigate to your repository on GitHub, click “Add file”, and select “Create new file”.
  2. Name the file README.md, add a brief description of your project, and provide a commit message. Play around with Markdown syntax!
  3. Click the green “Commit new file” button to save the README.md file to the repository.
  4. Pull the changes to your local repository.

🚀 Optional: Manage branches

  1. Push another branch (other than the default branch) with changes to MPIB GitLab or GitHub.
  2. Delete any unused or merged branches.

🚀 Optional: Clean up your repository on MPIB GitLab or GitHub

  1. Delete unnecessary files or add a new recipe directly on MPIB GitLab or GitHub.
  2. Commit changes on MPIB GitLab or GitHub with a message.
  3. Pull the changes to your local repository.

🚀 Optional: Clone and sync your repo

  1. Clone your repository from MPIB GitLab or GitHub to a different location on your computer.
  2. Stage, commit and push changes in the new location (consider using a new branch).
  3. Pull changes to the repository in the original location.
  4. Delete your newly cloned repository.

Slides

How can I download the slides as a PDF file?

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

Command Description
git remote Manages remote repositories
git clone Creates a local copy of a repository
git pull Fetches and merges the latest changes from a remote repository into the current branch
git fetch Updates remote tracking branches
git push Uploads local commits to a remote repository
© 2024 Dr. Lennart Wittkuhn
 
License: CC BY-SA 4.0