1 of 57

1

An Introduction to Git and GitHub

#OpenScienceKE

2 of 57

2

  • Welcome & Intro
  • What GitHub is and how it’s used
  • Public vs Private repositories
  • Hands on README editing
  • Small Group Work
  • Projects & other “social” features

Outline

3 of 57

Git is a Version Control System.

  • Helps to keep track of the entire history of things that you are working on.
  • Facilitates collaboration on projects

GitHub is one of hosting services for Git Repositories

  • Web-based service for version control and online collaboration
  • The social networking site for developers
  • Used to manage projects and build a portfolio

Git and GitHub

4 of 57

4

Project Management

… And how it’s used

5 of 57

5

Websites

… And how it’s used

6 of 57

6

Code documentation

Open educational resources (OER)

… And how it’s used

7 of 57

7

Open Data

… And how it’s used

8 of 57

8

So many things...

… And how it’s used

9 of 57

9

Sign up! (Have you already done this ?)

10 of 57

10

First Repo

11 of 57

12 of 57

Cases:

  • snake_case
  • camelCase
  • train-case (kebab-case)
  • Pascal_Case

13 of 57

14 of 57

  • Free for personal use
  • Useful for handling sensitive information
    • Internal organization communication
    • Conference organization
    • 1:1 consultations
  • Gateway for researchers uncomfortable with openness

Private Repositories

15 of 57

16 of 57

16

We are going to learn by doing

  • Go to: https://commonmark.org/

More resources:

Quick Intro to Markdown

17 of 57

18 of 57

19 of 57

20 of 57

20

Interface Tour & Jargon Busting

  • Fork
  • README
  • Issue
  • Main
  • Branch
  • Collaborator vs Contributor

21 of 57

21

Make your own copy of the entire repository

22 of 57

22

Ways to get all the files from the web to your computer

23 of 57

23

Make your own copy of the entire repository

When you Fork a repository, you make your own copy that lives online on your GitHub account. When you Clone, you are copying the version controlled files to your computer. Changes you make won’t affect the original in either case.

Ways to get all the files from the web to your computer

24 of 57

24

Create, assign & manage Issues by clicking on this tab

25 of 57

25

Create, assign & manage Issues by clicking on this tab

26 of 57

26

Your default branch is the Master - but you can switch or add branches here

27 of 57

27

Your default branch is the Main - but you can switch or add branches here

If your collaborators suggest changes, as we will all do later, their changes go onto a new Branch until you accept them and Merge their changes into the Main.

28 of 57

28

The README is automatically rendered when you visit a repo

29 of 57

29

Upload files from your computer to this repo

30 of 57

30

Create a new file

31 of 57

31

Settings - add collaborators here

32 of 57

32

Settings - add collaborators here

Collaborators have permission to make changes to files in your repository without your approval (they are the inner circle). Anyone can be a Contributor via Pull Requests (though you don’t need to accept their contributions).

33 of 57

33

The README is automatically rendered when you visit a repo

Create, assign & manage Issues by clicking on this tab

Your default branch is the Master - but you can switch or add branches here

Create a new file

Upload files

Ways to get all the files from the web to your computer

Settings - add collaborators here

Make your own copy of the entire repository

34 of 57

34

Jargon Busting!

  • Fork - A copy on GitHub
  • Clone - A copy on your computer
  • README - First thing you see in a repo
  • Issue - A way to manage, assign tasks
  • Main - The default “main” branch
  • Branch - An alternate version of the file
  • Collaborator vs Contributor

35 of 57

35

GitHub

:tada: = 🎉

36 of 57

36

  1. https://github.com/BioinfoNet/MyFirstFork
  2. Fork!
  3. Open README.md
  4. Click the pen to edit
  5. Personalize the README
  6. Commit changes!
  7. Send a pull request

Hands On Forking & README Editing!

🎉

37 of 57

37

Checkpoint

  • How did that go?
  • Where did you get stuck?
  • What was intuitive?
  • What was not?

38 of 57

38

Part 2

39 of 57

39

In Depth GitHub Functionality

  • Issue Tracking
  • Branching and Merging
  • Forking and Pull Requests

40 of 57

40

Issues Tracking

41 of 57

41

Issues

Issues are your “to-do’s” - they are the tasks you need to perform, the bugs you need to fix, and things you want to accomplish.

You can “label” issues and “assign” them to collaborators (or yourself) to do.

https://github.com/tiimgreen/github-cheat-sheet

42 of 57

42

Creating Issues:

43 of 57

43

Issue Tracking!

44 of 57

44

Branching and Merging

45 of 57

45

Creating a branch:

Notice when we create a branch - we can jump back and forth between our “READMEs” and see the different content. - <<quick demo! >>

46 of 57

46

Merging a branch into “master”:

You decide you like what you’ve done and want to merge those changes into your master branch. - <<mini demo >>

47 of 57

47

Creating a branch:

Notice when we create a branch - we can jump back and forth between our “READMEs” and see the different content. - <<quick demo! >>

48 of 57

48

Merging a branch into “master”:

You decide you like what you’ve done and want to merge those changes into your master branch. - <<mini demo >>

49 of 57

49

Forks & Pull Requests

50 of 57

50

Fork

VERB: To fork

you copy someone else’s repo with the intention to build on it/improve it and contribute back changes using “pull requests” - You are not a collaborator, but you may become a contributor.

You just did this!

NOUN: A fork

A copy of someone else’s project where you can make changes.

51 of 57

51

Pull Request

Make a pull request when you’ve made changes (commits) to a project.

Changes can be on a forked repo or a branch of your repo.

Merging these changes into the project either in the “master” branch or branch of interest. It is a “hey, pull these changes into the project”.

52 of 57

52

Hands on Exercise!

  • Fork a repo or become a collaborator
  • Make changes by writing in Markdown
  • Merge your changes with pull requests
  • Make something wonderful together!

53 of 57

53

Checkpoint

  • How did that go?
  • Where did you get stuck?
  • What was intuitive?
  • What was not?

54 of 57

54

Projects and other “Social” Features

  • Wiki
  • Projects
  • Watch/Start/etc.
  • Pulse and Graphs

55 of 57

55

Advanced GitHub

  • GH Pages
  • GitBook
  • Continuous Integration (Travis)

56 of 57

56

  • clone to local and demo from there
  • add vs. commit allows staging multiple files for single commit
  • allows local version control without cloud storage
  • reproducible research
  • resolve conflicts

Git command line demo

57 of 57

Danielle Robinson Jessica Gallinger

Steph Wright Steve Van Tuyl

These slides have been edited for OpenScienceKE and East Africa Open Science Tour workshop by Caleb

57

Slides Attributions