Find file
Fetching contributors…
Cannot retrieve contributors at this time
176 lines (110 sloc) 5.08 KB

Getting started

  • Open your text editor of choice. TextEdit works just fine.

Sign up for GitHub

GitHub free account sign up

  • You probably want to use your personal email rather than nclud email, as your Git user should be for you.

Set Up Git

GitHub help: Set Up Git

Download and install Git

  • Download the latest version of git
  • code.google.com/p/git-osx-installer/downloads/list?can=3
  • Download Git Installer 1.7.9.3 - OS X - Snow Leopard - Intel Universal
  • Once downloaded, open up the .dmg file
  • Open the package git-1.7.9.3-intel-universal-snow-leopard.pkg
  • Go through the installer

Starting Terminal

Terminal is simple application that allows you to use your computer like a nerd from the 70's, making use of the command line. Nerds today still use the command line. As Git is for nerds, all of Git's functionality is only available through the command line when it first installed.

  • Open Terminal
    • Easiest way to open Spotlight ( Cmd + Space ) and find Terminal
    • Or, in Finder, find it in /Applications/Utilities/

Once opened, you'll see something like this prompt:

Last login: Wed Mar 14 11:40:02 on ttys001
computer-name:~ username$

Gross.

  • Check that Git has been installed
  • type which git
  • type git --version

.

which git
# >> /usr/bin/git
git --version
# >> git version 1.7.9.3

Continue setting up Git

Getting the SSH key can be a pain

  • After creating SSH keys, we need to open id_rsa.pub
  • open ~/.ssh in Finder
    • If you are already in Terminal, type open .
    • or from Finder, go to folder ( Go > Go to Folder or Cmd + Shift + G ) ~/.ssh
  • Open id_rsa.pub in your text editor
  • Add this key as instructed on the GitHub help page

Starting GitHub app

  • Download the GitHub Mac app
  • In the preferences or intro screen, add your account details
    • Name
    • Email address
    • GitHub username or email address
    • GitHub password

Repos

  • Repo is short for repository. This is the name for our projects
  • Let's make a folder for our repos
  • In Finder, navigate to your home directory ~/ or Cmd + Shift + H
  • Create a new folder repos

Cloning via GitHub app

  • Clone this repo via GitHub app. Click on  Clone in Mac
  • In the save file prompt, clone this repo into your ~/repos/ folder as git-training

Making changes

  • Let's create a new file
  • Duplicate trainees/trainee-template.txt
  • Change the name of trainee-template copy.txt to firstname-lastinitial.txt, i.e. dave-d.txt
  • Awesome, now let's commit this change

Making a commit

  • Open the GitHub app
  • Select the nclud/git-training repo
  • In the left-hand icon navigation, select Changes
  • Under Uncommited Changes you'll see your new file already selected. This means the new file is already staged. (We'll get into staging later)

Commits require a message -- a basic statement to keep track of what changes you have made.

  • In commit summary, enter a message about adding the file, i.e. : Added dave-d trainee
  • Then click the Commit button
  • You'll see your commit as Unsynced Commit
  • View History (left-hand icon navigation) and you'll see your commit

We'll be syncing this commit later. Let's keep making changes.

Making more changes

  • Open your trainee file in a text editor (TextEdit works).
  • Add in your info.

For example:

Name: Dave D
Twitter: @desandro
Favorite 90's TV show: MTV Rock n Jock
Preferred breakfast food: English breakfast
Last time jumped rope: Prolly 2 years ago
Peanut butter [ smooth / chunky / ew gross ]: SUPERCHUNKY
  • Save the file

Making another commit

  • Back in GitHub app, go to Changes
  • You'll see the lines you have added in green, and the lines you have removed in red

In our case, all the previous lines have been removed, and all the edited lines appear as added. This is just how Git handles changes.

  • Like with the last commit, add a message Commit summary, i.e. Added trainee info for dave-d
  • Click Commit

Syncing

You should now have two unsynced commits.

  • Click the Sync button

Two things just happened:

  1. Your changes were pushed up to the GitHub remove server
  2. Other's people changes were pulled into your local repo

You should now see commits from your colleagues.

Finish with GitHub app

Awesome!

You are now on your way to collaborating with Git.

But...

The GitHub app is a great interface once for working with repos that are already on GitHub. But it doesn't do a good job with a lot of parts of Git. Like...

  • Creating a new repo
  • Checking out commits

GitX

  • Creating new repo
  • Checking out commits
  • Push
  • pull

GitHub site

  • viewing changes
  • submitting issues