Start Using Git on a Project

# cd into project your working on
cd <project>
# initialize a git repository
git init  
# add all of the files to the repository
git add .
# now commit the files to repository
git commit -m "My first commit message"

Later, check which files have changed and are out of sync

# this will list changed files and new files
git status
# this will add the newly updated updated_file.php to the commit
# staging area
git add updated_file.php
# commit changes with a good change message
git commit -m "Fixed missing name bug in updated_file.php"

Create a remote repository

# ssh into server and create repository directory
mkdir myproject
cd myproject
# --bare option means this repository will be pushed to and pulled
# from but never worked in directly (ie it will be a repository without working
# files).  This caused me no small amount of confusion when I first
# started using git.  
git init --bare
# exit out of distant vladivostok server
# cd into local project
cd project
# add the remote repository
git remote add vladivostok
# now you can push a branch of the repository to the remote
# repository, "master" is the default main branch in git
git push vladivostok master

Sweet! Now your code is backed up on a remote server. In fact your code’s entire history is on the remote server. Everytime you make a commit on the local server, you can push that change to the remote server as well.

Good Git Introductions

Getting Started With Git Everyday Git with 20 commands or so

Git Next Level

Think like a Git Git: Revision Control Perfected

Git 201: Slightly More Advanced

A Git Primer Git for Computer Scientists The Thing About Git

Git Workflow

Github’s Git Workflow

Git-flow a more complex workflow

Github Stuff

Getting the Hang of Github