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 |
This session
In this session, you will work on the following tasks:
- Reading: Read the chapter “GitHub - Advanced” in the Version Control Book.
- Implementation: Try out the commands in the chapter.
- Exercises: Work on the exercises for the
recipes
project. - Quiz: Test your knowledge with the quiz.
As always:
- Try out the commands of this session and play around with them.
- Check whether you have achieved the learning objectives.
- Ask questions!
- Let’s git started!
Learning objectives
Remotes - Advanced
💡 You can fork a repository.
💡 You know the purpose and components of a Pull Request.
💡 You can create a Pull Request from a forked repository.
💡 You know how to collaborate using the popular workflow strategy GitHub flow.
💡 You know the purpose and components of a README
file.
💡 You can protect your main
branch.
Issues
💡 You understand the purpose of GitHub Issues.
💡 You can create and manage Issues.
💡 You can reference an Issue in another issue.
💡 You can close an Issue with a commit or pull request.
recipes
project
At the end of this session, you should have accomplished the following:
- You forked a public / internal
recipes
repository of another course participant. - You opened an Issue in another repository.
- You created a pull request with changes that “fix” the Issue you opened.
- You reviewed and merged a pull request to integrate new content from a partner.
Please keep the recipes
folder! We will continue to use it in the following sessions.
Exercises
“Public” collaboration with pull requests (using a fork and GitHub Flow)
- Find out what forking is.
- Fork the recipes repository of another course participant (ideally someone who is not your collaborator from the previous exercise).
- Create an Issue in your new collaborator’s repository (maybe their repository is missing a great recipe?).
- Repeat the steps from the exercise on collaboration with remote repositories using the forked repository:
- Clone the forked repository into a sensible location on your computer.
- Create a new branch and create one or multiple commits “fixing” the Issue that you opened. If available, follow the contributing guide of your collaborator’s repository.
- Push your changes to the remote repository.
- Create a pull / merge request with your changes (hint: from the forked to the original repository) and refer to the Issue in your pull / merge request.
Reviewing pull requests
- View any pull requests that are created in your
recipes
repository. - Review the changes made by the contributor in the pull request.
- If needed, discuss additional changes with the contributor in the pull request.
- Close the pull request by merging the proposed changes.
🚀 Bonus exercises
- Repeat the entire forking workflow with Lennart’s
recipes
repository. Find out about the contributing guidelines in Lennart’s repo and follow them when creating a new recipe.
Slides
To export the slides to PDF, do the following:
- Toggle into Print View using the E key (or using the Navigation Menu).
- Open the in-browser print dialog (CTRL/CMD+P).
- Change the Destination setting to Save as PDF.
- Change the Layout to Landscape.
- Change the Margins to None.
- Enable the Background graphics option.
- 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:
These instructions were copied from the Quarto documentation (MIT License) and slightly modified.