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
- Files = Your Code
- Folders = Your organization of your code
- Git = Local Code Repository (Package)
- Manages local versions of folder and file changes
- Can backup to remote (or online) code repository
- GitHub or BitBucket = Remote (Online) Code Repository
- GitHub: free public repositories used by most open source projects, including Facebook (users must pay $7/month for private repositories)
- BitBucket: free public repositories + allows free private remote repositories with up to 5 developers
SETUP GIT
ONLINE ACCOUNT
SETUP LOCAL REPOSITORY
- Download Git for Command Line
- See if it worked:
- Mac Terminal: type "git help"
- *IF "Command not found," download Xcode: Go to Xcode > Preferences > Downloads > Install “Command Line Tools”
- Windows Git Bash (basically a unix like version of command line): type "git help"
- Download Git GUI: for Mac | for Windows
- 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
- Github.com/new
- Create a new repo (online remote repository)
Local Repository
Terminal for Mac or Git Bash for Windows
- Navigate to the top folder of the software project: cd folder
- git init
- git add -A
- -A means all files
- git commit -m "first commit"
- -m means message
- git remote add origin https://github.com/username/project.git
- git push -u origin master
- -u means upstream... aka: push upstream to origin from master
Windows Git GUI
- +add
- Select name & directory
- Check “Push to GitHub.com”
Mac Git GUI
- File > Create New Repository
- Select name & directory
- Check “Push to GitHub.com”