Contributing with GitHub via its interface

Authors: orcid logoAvatarBérénice Batut
Overview
Questions:
  • How can I contribute to an open-source project with GitHub and its interface

Objectives:
  • Edit a file via GitHub interface

  • Create a pull request

  • Update a pull request

Time estimation: 20 minutes
Supporting Materials:
Last modification: Mar 23, 2023
License: Tutorial Content is licensed under Creative Commons Attribution 4.0 International License The GTN Framework is licensed under MIT

Introduction

All the training material which you find on https://training.galaxyproject.org/training-material/ is stored on a GitHub repository (https://github.com/galaxyproject/training-material), a code hosting platform for version control and collaboration. GitHub interface is quite intuitive and simplifies the contributions from anyone.

Agenda

In this tutorial, you will learn how to use GitHub interface to contribute to the training material:

  1. Introduction
  2. GitHub
  3. Edit a file
  4. Open a Pull Request
  5. Update a Pull Request
  6. Close the Pull Request
  7. Conclusion

GitHub

The GitHub repository for the training material is: https://github.com/galaxyproject/training-material.

Hands-on: Familiarization with GitHub
  1. Go on the GitHub repository: https://github.com/galaxyproject/training-material

    GitHub interface.
    Figure 1: Interface of the GitHub repository of the training material
  2. Click on CONTRIBUTORS.yaml file

    Click on CONTRIBUTOR.

  3. View the file

    You should see something like:

    Click on CONTRIBUTOR.
    Figure 2: CONTRIBUTOR file

This CONTRIBUTORS.yaml file is where we collect the information (name, email, etc) about the different contributors to display them on our Hall of Fame. You will add your information there. But first you need to sign in to GitHub to be able to change this file.

Hands-on: Sign in to GitHub
  1. Create a GitHub account (if you do not have one already)

    GitHub signup.

  2. Sign in (once you have a GitHub account)

Edit a file

You can now modify the CONTRIBUTORS.yaml file to add your information there

Hands-on: Edit a file
  1. Open the CONTRIBUTORS.yaml file on GitHub
  2. Click on hands_on icon (top right of the file)

    GitHub edit.

    A new page will open:

    GitHub contributor edit page.
    Figure 3: CONTRIBUTOR file in edit mode
  3. Modify the CONTRIBUTORS.yaml by adding yourself

    You should use your GitHub username and add it followed by : (the : is important) at the correct position given the alphabetical order.

  4. Scroll down to the bottom of the file
  5. Fill the Propose file change form

    It can also be named Commit changes for the ones with write accesses to the repository

    1. Fill the box “Update CONTRIBUTORS.yaml” with “Add < GitHub username > as contributor” (replace < GitHub username > by your GitHub username)

      Comment: Commit messages

      This a commit message: a description explaining why a particular change was made. Theses messages capture the history of the changes, so other contributors can understand what have been done and why

    2. Leave “Add an optional extended description…” empty

    Propose file change form.

  6. Click on Propose file change

    Submit propose file change form.

Without realizing it, GitHub let you create your first branch (named here patch-1) and add a changement on this branch.

Comment: Branching

Branching is the way to work on different versions of a repository at one time. By default your repository has one branch named main which is considered to be the definitive branch. When you create a branch off the main branch, you’re making a copy, or snapshot, of main as it was at that point in time.

By changing a file in this branch, it will diverge from the main branch. It will contain data that is only on this new branch.

Open a Pull Request

Then the addition of your information in the CONTRIBUTORS.yaml file is currently only on your branch patch-1. Not on the main branch and so not only on the Hall of Fame. You can’t add or push directly to the main branch, so you need to create what we call a pull request.

The GitHub interface guides you through this process: after clicking on Propose file change, a new page opens:

Pull request form.
Figure 4: Pull request form
Hands-on: Edit a file
  1. Open and read the CONTRIBUTING.md file
  2. Come back to the pull request
  3. Fill in the pull request description

    Pull request description.

    1. Add a title for the Pull Request
    2. Add a message explaining the changes you made

      This message is a good way to introduce yourself and to explain the message you made. Be kind and descriptive. It helps the reviewers to understand why you did your changes and if it should be intergrated into the main branch (and then website).

      Comment: Pull request messages

      GitHub uses Markdown, a simple Markup language, to render the Pull request messages. You can then add bold test, lists, images, etc.

  4. Scroll down and check the changes you made

    • In green with +: what you added
    • In red with -: what you deleted
  5. Click on Create pull request or switch to Create draft pull request from the dropdown menu

    Create pull request dropdown in the GitHub interface is shown, the draft pull request button option is highlighted.

    Creating a pull request as a draft serves as an indication that you are still working on the content. Reviewers may comment on the current state and give general feedback, but they will know that they are not looking at the final version of your contribution.

    In the Galaxy Training Material repository we have also disabled the computationally most expensive automated tests on draft pull requests, and we encourage you to use the draft stage as a small contribution to sustainable computing.

You have created your first pull request!

Your pull request will be reviewed. There are two possible outcomes:

  1. Your pull request is accepted. Congratulations! Your changes will be merged into the main branch of the original repository. The website will be re-built and you will be in the Hall of Fame
  2. Your pull request needs modifications: the reviewers will ask for some changes, possibly because the automatic tests are failing.

Update a Pull Request

One of the reviewers of your pull request asked you to add your name after your GitHub username in the CONTRIBUTORS.yaml file.

Hands-on: Update a Pull Request
  1. Go to the list of pull request tab on GitHub
  2. Click on your pull request

    You can see here the comments the reviewers left you

  3. Click on Files changed tab and see the changes you made

    Pull request files changed tab.

  4. Click on hands_on icon
  5. Add your name below your GitHub username

    It should look like:

    bebatut:
         name: Bérénice Batut
    
  6. Navigate to the bottom of the file
  7. Fill the Commit changes form, similarly to the Propose file change form before
  8. Make sure the Commit directly to the patch-1 branch is selected

    Commit directly to the `patch-1` branch.

  9. Click on Commit changes

    Submit propose file change form.

    The pull request should be automatically updated

  10. Check that the new changes are added to the pull request on GitHub

Close the Pull Request

Great! You now know how to make pull request on GitHub, and how to make changes after a review. Reviewers can now approve and merge your pull request.

Because this was just a practice pull request, let’s close it again.

Hands-on: Close the Pull Request

Once you have run through all these steps, please close the pull request again.

  1. Go to the list of pull request tab on GitHub
  2. Click on your pull request
  3. Scroll to the bottom of the page
  4. Click on “Close pull request” button

Whenever you add your first real contribution, you can add yourself to the CONTRIBUTORS.yaml file in that PR.

Conclusion

With this tutorial, you learn how to use GitHub to change a file, create a pull request and then contribute to the training material. What you have learned here can be applied to any file.

Via the GitHub interface, you can also go further: create file, branch directly, etc. To learn that, we recommend you to read the GitHub guide

Key points
  • You can’t add or push directly to the main branch, so you need to create a pull request

  • 1 pull request = 1 branch

  • The pull request is the foundation of the collaborative development of the training material

Frequently Asked Questions

Have questions about this tutorial? Check out the tutorial FAQ page or the FAQ page for the Contributing to the Galaxy Training Material topic to see if your question is listed there. If not, please ask your question on the GTN Gitter Channel or the Galaxy Help Forum

Feedback

Did you use this material as an instructor? Feel free to give us feedback on how it went.
Did you use this material as a learner or student? Click the form below to leave feedback.

Click here to load Google feedback frame

Citing this Tutorial

  1. Bérénice Batut, Contributing with GitHub via its interface (Galaxy Training Materials). https://training.galaxyproject.org/training-material/topics/contributing/tutorials/github-interface-contribution/tutorial.html Online; accessed TODAY
  2. Batut et al., 2018 Community-Driven Data Analysis Training for Biology Cell Systems 10.1016/j.cels.2018.05.012



@misc{contributing-github-interface-contribution,
author = "Bérénice Batut",
title = "Contributing with GitHub via its interface (Galaxy Training Materials)",
year = "",
month = "",
day = ""
url = "\url{https://training.galaxyproject.org/training-material/topics/contributing/tutorials/github-interface-contribution/tutorial.html}",
note = "[Online; accessed TODAY]"
}
@article{Hiltemann_2023,
	doi = {10.1371/journal.pcbi.1010752},
	url = {https://doi.org/10.1371%2Fjournal.pcbi.1010752},
	year = 2023,
	month = {jan},
	publisher = {Public Library of Science ({PLoS})},
	volume = {19},
	number = {1},
	pages = {e1010752},
	author = {Saskia Hiltemann and Helena Rasche and Simon Gladman and Hans-Rudolf Hotz and Delphine Larivi{\`{e}}re and Daniel Blankenberg and Pratik D. Jagtap and Thomas Wollmann and Anthony Bretaudeau and Nadia Gou{\'{e}} and Timothy J. Griffin and Coline Royaux and Yvan Le Bras and Subina Mehta and Anna Syme and Frederik Coppens and Bert Droesbeke and Nicola Soranzo and Wendi Bacon and Fotis Psomopoulos and Crist{\'{o}}bal Gallardo-Alba and John Davis and Melanie Christine Föll and Matthias Fahrner and Maria A. Doyle and Beatriz Serrano-Solano and Anne Claire Fouilloux and Peter van Heusden and Wolfgang Maier and Dave Clements and Florian Heyl and Björn Grüning and B{\'{e}}r{\'{e}}nice Batut and},
	editor = {Francis Ouellette},
	title = {Galaxy Training: A powerful framework for teaching!},
	journal = {PLoS Comput Biol} Computational Biology}
}

                   

Congratulations on successfully completing this tutorial!
Developing GTN training material
This tutorial is part of a series to develop GTN training material, feel free to also look at:
  1. Creating a new tutorial
  2. Contributing with GitHub via command-line
  3. Creating Slides
  4. Overview of the Galaxy Training Material
  5. Tools, Data, and Workflows for tutorials
  6. Running the GTN website online using GitPod
  7. GTN Metadata
  8. Generating PDF artefacts of the website
  9. Updating diffs in admin training
  10. Principles of learning and how they apply to training and teaching
  11. Running the GTN website locally
  12. Design and plan session, course, materials
  13. Teaching Python
  14. Contributing with GitHub via its interface
  15. Adding auto-generated video to your slides
  16. Including a new topic
  17. Creating content in Markdown
  18. Adding Quizzes to your Tutorial
  19. Creating Interactive Galaxy Tours