Fork me on GitHub

Collaborative distributed version control

We have learned how to make a git repository for a single person. What about sharing?

  • Sharing by email or manually: isn’t fun and doesn’t scale, projects are limited to the time and cognition of one person.
  • One person’s repository on the web: allows one person to keep track of more projects, gain visibility, feedback, and recognition.
  • Centralized: everyone can directly update the same repository. Good for small groups.
  • Distributed: anyone can suggest changes, even without advance permission. Maintainers approve what they agree with.

Being able to share more easily (going down the list here) is transformative because it allows projects to scale to a new level. This can’t be done without proper tools.

In this lesson we will learn how to keep repositories in sync and how to work with remote repositories on GitHub and other services. We will discover and exercise the centralized as well as the forking workflows, and finally look into how to automate tasks using Git hooks.

Prerequisites

  1. Basic understanding of Git.
  2. You need a GitHub account.

We will do this exercise on GitHub but also GitLab and Bitbucket allow similar workflows and basically everything that we will discuss is transferable. With this material and these exercises we do not endorse the company GitHub. We have chosen to demonstrate a number of concepts using examples with GitHub because it is currently the most popular web platform for hosting Git repositories and the chance is high that you will interact with GitHub-based repositories even if you choose to host your Git repository on another platform.

We also encourage course participants to use our new Nordic research software repository platform, for more information see https://coderefinery.org/repository/.

Schedule

20 min Copying, sharing, and synchronizing repositories How can we backup repositories?
How can we share repositories with others?
How can we keep repositories in sync?
What are different ways to make a copy of the entire repository?
60 min Centralized workflow How can we collaborate with others within one repository?
60 min Distributed version control and forking workflow How can we collaborate with people who we might not know yet?
What is a fork?
What is a pull request or merge request?
What is code review?
How do teams collaborate on GitHub or GitLab or Bitbucket?
15 min How to contribute changes to somebody else's project What steps can we recommend to contribute changes to somebody else's project?
5 min (Optional) Hooks How can we automate tasks depending on events in the Git repository?
10 min (Optional) Non-bare and bare repositories What are bare repositories?
How can we create a common repository for a group on our local computer or server?