A friendly introduction to GitHub as part of @OpenDataManchester's Pick N Mix series.
Table of Contents:
We will first work through the GitHub Guides Hello World tutorial. The guide teaches you how to
Demonstration (steps are from the GitHub Guides Hello World tutorial, see the guide for full context, screenshots, and further instructions):
+
in the upper right corner next to your avatar or identicon and then select New repository
.hello-world
, write a short description, check the box to Initialize this repository with a README
, and then click Create repository
.master
which is considered to be the definitive branch (although GitHub is working on changing it to a neutral term such as main
). We use branches to experiment and make edits before committing them to the default branch. To create a new branch, click the drop down at the top of the file list that says branch: master
. Type a branch name, readme-edits
, into the new branch text box and select Create branch: readme-edits
.readme-edits
branch of our repository which for now looks just like our default branch - but not for long as we are going to make changes to the README. Click the README.md
file.I am currently demonstrating how to create and use a **repository**, start and manage a new **branch**, and make changes to a file and **push** them to GitHub as **commits**.
Once I’ve added my changes I can scroll to the bottom to add a meaningful commit message that describes the changes and then click the Commit changes
button. These changes will be made to just the README file on the readme-edits
branch, so now this branch contains content that’s different from the default branch.
readme-edits
branch, it is time to open a pull request to merge these changes into the default branch. Click on the Pull Request
tab at the top of the repo, then from the Pull Request page, click the green New pull request
button. (Alternatively, you can take advantage of GitHub’s more recent features. There should be a notification highlighted in yellow that indicates readme-edits had recent pushes
with a green Compare & pull request
button which you can click to skip step 7.)compare
box, select the branch you made, readme-edits
, to compare with base: master
(the original). Pay careful attention to the direction of the arrow when choosing how to compare branches. Look over the changes in the diffs and make sure they’re what you want to submit. When you’re satisfied that these are the changes you want to submit, click the big green
Create pull request` button.This pull request adds information about the demonstration to the README.
When you’re done with your message, click Create pull request
!
readme-edits
branch into the master
branch. Click the green Merge pull request
button to merge the changes into master
and click Confirm merge
. (You can then go ahead and delete the branch, since its changes have been incorporated, with the Delete branch
button.) Congratulations, you’ve opened and merged your first pull request! :tada:Next, I will demonstrate how to make a contribution to another user’s repository where I don’t have write access. In this example, I will add my resources to Open Data Manchester’s Training and Resources repository where they share all the resources related to their Pick N Mix series. We will learn how to
Demonstration:
training-and-resources
repository: https://github.com/OpenDataManchester/training-and-resources. I explore the contents to learn more about the repository and see how best to contribute.Fork
button.Pick-N-Mix
folder. Based on the existing structure, I can see that I should add a sub-directory with a README linking to the resources for my Intro to GitHub Pick N Mix session.Add file
button and select Create new file
.readme.md
in a folder called Intro to GitHub
. To do this, I type
Intro to GitHub/readme.md
into the box where is asks you to Name your file..
. The backslash is what allows you to create a new folder with the file inside.
Resources and links for Pick N Mix 9: an introduction to Github, with Dr Rachael Ainsworth, 30th June 2020.
[Materials/resources for session](https://github.com/rainsworth/intro-to-github)
[Rachael on Twitter](https://twitter.com/rachaelevelyn)
[HER+Data MCR on Twitter](https://twitter.com/herplusdatamcr)
[HER+Data MCR on Meetup](https://www.meetup.com/HER-Data-MCR)
create intro to github readme
and click Commit new file
.
This branch is 1 commit ahead of OpenDataManchester:master.
with links to Pull request
and Compare
. Click Pull request
. When I am ready to submit my contributions back to the original repository for consideration, click
Create pull request`. This pull request adds the list of resources for Pick N Mix 9: an introduction to Github.
Create pull request
to request that the repository owners pull your contributions into their project. Congratulations, you’ve contributed to an open source project! :tada:For a beginners guide to creating a personal website using GitHub Pages, check out the GitHub Guides Getting Started with GitHub Pages tutorial and the GitHub Pages course on GitHub Learning Lab. If you want to practice more of the concepts that we covered in the previous demonstration, you can follow the steps outlined below.
Settings
tab to update the repository name to username.github.io
(replacing “username” with your GitHub username) and enable GitHub Pages by selecting a permitted branch (usually master
or gh-pages
) as a source for your webpage. GitHub will then indicate where your site is published in a green notification box (in this case, at https://username.github.io where “username” is your GitHub username).Code
tab and edit the _config.yml
file to point to your repository, change the title and any other user information.README
to include information about the website or project repository (read more about README
files here).Previous: GitHub Interface Tour and Jargon Busting