Git Intro & Setup

Tutorial: try.github.com
WHAT IS GIT?

GIT is simply a snapshot of your software folder+file structure.  Technically, it is a version control software for decentralized source code management.  Best of all, it's free and open source.
  • Software consists of files in a series of folders.
  • Git sits in the top folder recording/indexing everything that happens to the files and folders.  This includes changes, updates, removals as well as which developer did what when.
  • Basically, Git is the scribe for a meeting: noting everything that happens to the code.

VERSION TRACKING SNAPSHOTS

SOFTWARE DEVELOPMENT JARGON
Git can be intimidating at first because of its array of new vocabulary.  Git can track changes of your software directory, create local packaged code backups, send a code package to the cloud (aka, upload code changes/additions as well as incremental versions).

  • Work Directory = folder where software code sits
    • add = adds changes to code waiting list
    • commit = adds changes to the local code package
  • Repository = repo = Packaged storage for Code
    • push = sends local code package to online code package
    • fork = fetch = pull = downloads online code package to one of your own folders

TOP DOWN
 

BOTTOM UP

  1. Files = Your Code
  2. Folders = Your organization of your code
  3. Git = Local Code Repository (Package)
    • Manages local versions of folder and file changes
    • Can backup to remote (or online) code repository
  4. GitHub or BitBucket = Remote (Online) Code Repository

SETUP GIT

ONLINE ACCOUNT
  1. Sign Up for GitHub or BitBucket

SETUP LOCAL REPOSITORY
  1. Download Git for Command Line
  2. Download Git GUI:  for Mac | for Windows
  3. Terminal for Mac or Git Bash for Windows
    • git config --global user.name "Your Name Here"
    • git config --global user.email "your_email@youremail.com"

CREATE PROJECT
Remote Repository
  1. Github.com/new
  2. Create a new repo (online remote repository)

Local Repository
Terminal for Mac or Git Bash for Windows
  1. Navigate to the top folder of the software project:  cd folder
  2. git init
  3. git add -A
    • -A means all files
  4. git commit -m "first commit"
    • -m means message
  5. git remote add origin https://github.com/username/project.git
  6. git push -u origin master
    • -u means upstream... aka: push upstream to origin from master

Windows Git GUI
  1. +add
  2. Select name & directory
  3. Check “Push to GitHub.com”

Mac Git GUI
  1. File > Create New Repository
  2. Select name & directory
  3. Check “Push to GitHub.com”