Licensed under the Creative Commons attribution-noncommercial license, http://creativecommons.org/licenses/by-nc/3.0/. Please share and remix noncommercially, mentioning its origin.
CC-BY_NC



Objectives

“The Microsoft Windows ‘port’ of Git is primarily a Linux emulation framework that hosts the Linux version. […] Currently there is no native port of Git for Windows.”



Getting started with git and github

  1. Get an account on github.

  2. If you are on a Mac or Linux machine, git will likely be installed already. Otherwise, you can download and install it from git-scm.com/downloads.

  3. Set up your local git installation with your user name and email. Open a terminal and type:

$ git config --global user.name "Your name here"
$ git config --global user.email "your_email@example.com"

(Don’t type the $; that just indicates that you’re doing this at the command line.)

  1. Optional but recommended: set up secure password-less SSH communication to github, following the github instructions. If you run into difficulties, it may help to look at Roger Peng’s SSH help page.


Basic git concepts


git graph



An elementary task: cloning a remote repository

git clone git@github.com:ionides/810f15
[ionides@feller 810f15]$ git pull
Already up-to-date.


A workflow to contribute to the 810f15 github repository

Forking a project and making a pull request

Forking is making your own github copy of a repository. A pull request is a way to ask the owner of the repository to pull your changes back into their version. The following steps guide you through a test example.

  1. Go to ionides/810f15 on github, for example by searching for 810f15.

  2. Click fork at the top right-hand corner, and follow instructions to add a forked copy to your own github account. It should now show up in your account as my_username/810f15.

  3. Clone a local copy of the forked repository to your machine, e.g.,

git clone git@github.com:my_username/810f15
  1. Move to the 810f15 directory and edit the file sign_here.html to add your own name.

  2. It can be helpful to type

git status

regularly to check on the current state of the repository.

  1. Commit this change to your local version of the forked 810f15,
git add sign_here.html
git commit -m "sign up for my_name"

and see how the git status has changed. Another useful command for checking on the recent action in the repository is

git log
  1. Push this change to the forked 810f15 on github:
git push
  1. On the github web site for the my_username/810f15 fork, click New pull request and follow instructions. When you have successfully placed your pull request, the owner of the forked repository (me) will be notifed. I will then pull the modifications from your fork into ionides/810f15.