Using git and github

Using git and github

"Learning the basics of version control using git, as well as the social coding platform called github."

Information

The estimated time to complete this training module is 4h.

The prerequisites to take this module are:

Contact Pierre Bellec if you have questions on this module, or if you want to check that you completed successfully all the exercises.

Resources

This module was presented by Elizabeth Dupre during the QLSC 612 course in 2020, with content adapted from the software carpentries by Elizabeth Dupre.

All the tutorial notes are available here.

The video of her presentation is available below:

ATTENTION!

For the last lecture of the Introduction to Git and GitHub module (Pull Requests) please use this repo under Brainhack School 2022 Github organization to complete the tutorial instead of the one indicated in the tutorial (due to it is no longer in use.). Thank you!

Exercise

  • send a request through discord on #git-github with your GitHub user name to Isil Bilgin to be added to the github organization brainhack-school2022.
  • create a local repository following the naming convention <last_name>_project. Don’t worry, you will be able to change this name later, and possibly merge the content in another repository if you decide to team up with other people.
  • initialize your repo with a README and a LICENSE.
  • Create an issue for adding a short bio.
  • Using the command line, clone the repository locally to your computer.
  • Create a branch named after the issue, e.g. iss1.
  • Add a short bio to the README, including a picture of your github avatar. You can adapt the following snippet
<a href="https://github.com/pbellec">
   <img src="https://avatars.githubusercontent.com/u/1670887?v=4?s=100" width="100px;" alt=""/>
   <br /><sub><b>Pierre bellec</b></sub>
</a>

This is a bit of html, which gets rendered in markdown documents. You will need to click on your profile picture to figure out what to replace 1670887 with the ID of your profile picture. Don’t forget to replace pbellec by your github handle.

  • Using the command line, commit this change to your local repository. Make sure you registered your github user name and email address, so the commit is accurately credited to you when you push it on github.
  • Using the command line, push the branch and your changes to the github repository.
  • Using the github interface, open a new pull request with your changes. Use a descriptive name for the pull request, e.g. iss1 - add bio.
  • Using the github interface, request a review of your changes by complexbrains (Isil Bilgin).
  • Once complexbrains has approved the review, merge the pull request to the main branch.
  • Close the issue.
  • Follow up with Isil Bilgin to validate you completed the exercise correctly.
  • 🎉 🎉 🎉 you completed this training module! 🎉 🎉 🎉

More resources

Here is an interactive page to learn Git and visually observe how the branching works under version control.

For more detailed instructions please check GitHub’s resources

Please also check The Turing Way’s guideline or Mozilla GitHub documentation for using GitHub for open research.

For common Mistakes and Experiences with using Git and Github: dangitgit.com

If you are curious to learn more advanced capabilities for git, you can check this tutorial “Effective use of git” by Ankur Sinha organized for the INCF/OCNS software working group.