After the last session, you should now be able to answer the following questions / do the following:
💡 You can create a remote repository. 💡 You can connect your local Git repository to a remote repository service like GitHub or GitLab. 💡 You can pull and push changes to and from a remote repository. 💡 You can clone a repository from a remote repository.
Last session: 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
Last session: recipes project
At the end of this session, you should have accomplished the following:
You created a GitHub account.
You connected your GitHub account to your local Git using SSH.
You created a new private(!) GitHub repository.
You uploaded (i.e., “pushed”) the default branch of your recipes repository to GitHub.
Collaboration Option 1:
You invited a partner from the course as a collaborator to your recipes on GitHub.
You collaborated on a shared project by adding and committing changes to your partner’s repository.
Collaboration Option 2:
You clone your own repository to a different location on your computer.
Stage and commit changes in the repository in this new location.
Push the changes to GitHub and pull them in the original repository location on your computer.
Optional:
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.
💡 You know the purpose and components of a Pull Request. 💡 You know how to collaborate using the popular workflow strategy GitHub flow. 💡 You know the purpose and components of a README file. 💡 You can fork a repository. 💡 You can create a Pull Request from a forked repository. 💡 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.
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
Fork the project repository of the course instructor or another course participant (ideally, someone who is not your collaborator from the previous exercise).
Create an Issue in your new collaborator’s repository, indicating an entry that you think is still missing in their repository.
Repeat the steps from the exercise on collaboration with remote repositories using the forked repository:
Clone the forked repository to a sensible location on your computer.
Create a new branch and make 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.
Use Lennart’s recipes repository. Find out about the contributing guidelines in Lennart’s repo and follow them when creating a new recipe.
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.
Solutions
Forking is a process where you create a copy of someone else’s repository under your own account. It allows you to freely experiment with changes without affecting the original project.
To fork the project repository of another course participant: (1) Go to the GitHub repository you want to fork. (2) Click the Fork button at the top-right corner of the repository page. (3) Select your GitHub account to fork the repository.
Create an Issue, suggesting a missing entry: (1) Go to the Issues tab of your partner’s repository on GitHub. (2) Click New issue. Provide a title and description for the Issue, suggesting a missing entry. (3) Click Submit new issue.
Clone the forked repository to a sensible location on your computer.