Session 7: Collaboration on GitLab / GitHub

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

Course at Max Planck Institute for Human Development

Slides | Source

License: CC BY 4.0 DOI

15:00

1 Last session: Integration with GitLab / GitHub

Last sessions: Learning objectives

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

đź’ˇ 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.

Last session: 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.

2 This session: Collaboration on GitLab / GitHub

This session: Collaboration on GitLab / GitHub

Image from Techdobz

This session: Issues

Link to Issue

Reading

https://lennartwittkuhn.com/version-control-book/chapters/github-advanced.html

Learning objectives

GitHub - 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.

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

GitHub Flow

Image from Sebass van Boxel

Tasks

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

  1. Reading: Read the chapter “GitHub - Advanced” 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!

recipes project

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

  1. You forked a public / internal recipes repository of another course participant.
  2. You opened an Issue in another repository.
  3. You opened a pull request with changes that “fix” the Issue you opened.

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

Exercises

1. “Public” collaboration with pull requests (using a Fork)

  1. Find out what forking is
  2. Fork the recipes repository of another course participant (who is not your partner from the previous exercise)
  3. Create an issue, suggesting a missing recipe
  4. Create an issue in your partner’s repository (maybe their repo is missing a great recipe?)
  5. Repeat the steps from the previous exercise using the forked repository:
    1. Clone the forked repository into a sensible location
    2. Create a new branch and create one or multiple commits “fixing” the issue that you opened
    3. Follow the contributing guide in Lennart’s repo to create a new recipe
    4. Push your changes to GitHub
    5. Create a pull request with your changes (hint: from the fork to the original repo) and refer to the issue in your pull request

2. Review pull requests in your repository

  1. View any pull requests that are created in your recipes repository.
  2. Review the changes made by the contributor in the pull request.
  3. If needed, discuss additional changes with the contributor in the pull request.
  4. Close the pull request by merging the proposed changes.

🚀 Optional: Practice forking on GitHub

  1. Repeat the entire forking workflow (see task 1 above) with Lennart’s recipes repository.