2 Github Tutorial

GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.

Github Jargon

With a language all its own, this quick guide to common terms of GitHub and Git will have you collaborating in no time.

Repository

A repository is the most basic element of Git and GitHub. Imagine it as a project’s folder. A repository contains all of the project files (including documentation), and stores each file’s revision history.

Commit

An individual change to a file (or set of files). With Git, every time you save it creates a unique ID (a.k.a. the “SHA” or “hash”) that allows you to keep record of what changes were made when and by whom. Commits usually contain a commit message which is a brief description the changes made.

Branch

A parallel version of repository. It is contained within the repository, but does not affect the primary or master branch allowing you to work freely without disrupting the “live” version.

Remote

The connection of a local repository with one on GitHub. It permits revision history to be synchronized by publishing local commits and downloading any new changes from GitHub.

Pull Request

A feature on GitHub which provides conversation, line-by-line code review, change history analysis, and summaries of modified files.

Using GitHub 1

Step 1. Create a Repository

A repository is usually used to organize a single project. Repositories can contain folders and files, images, videos, spreadsheets, and data sets – anything your project needs. We recommend including a README, or a file with information about your project. GitHub makes it easy to add one at the same time you create your new repository. It also offers other common options such as a license file.

Your hello-world repository can be a place where you store ideas, resources, or even share and discuss things with others.

To create a new repository

  • In the upper right corner, next to your avatar or identicon, click “+” and then select New repository.
  • Name your repository hello-world.
  • Write a short description.
  • Select Initialize this repository with a README.

Step 2. Clone Repository

When you create a repository on GitHub, it exists as a remote repository. You can clone your repository to create a local copy on your computer and sync between the two locations.

To clone a repository

  • On GitHub, navigate to the main page of the repository.
  • Under your repository name, click Clone or download.

  • Click Open in Desktop to clone the repository and open it in GitHub Desktop.

  • Click Choose… and, using Windows Explorer, navigate to a local path where you want to clone the repository.

  • Click Clone.

Step 3. Commit a change in your project

As you make changes to files in your project and save them locally, you will also see the changes in GitHub Desktop.

  • The red icon indicates removed files.
  • The yellow icon indicates modified files.
  • The green icon indicates added files.

  • Select the changes that you want reflected on your GitHub repository (usually all changes are commited).
  • At the bottom of the list of changes, in the Summary field, type a short, meaningful commit message.

  • Under the Description field, click Commit to master.
  • Click Push origin to push your changes to the remote.

That’s it! Your changes are now up on GitHub.