Getting Started with Git

Below are some helpful links and tips for getting started with the Git version control system.

Git is rapidly becoming one of the most widely used version control systems is use today. Git is especially is open source projects as it allows for rapid merging: a feature not found in most version control systems. Git is also compact and FAST.

If you’re a developer, I encourage you to write open source software as a means of deliberate practice. Using Git in the context of open source will really help other contribute and use your work. I recommend github.com specifically. Even professionally, I think that Git’s market share will continue to rise and be more prevalent in the workplace.

After using subversion for years, I dropped it in favour of Git. And below are a few notes that I learned along the way that may make it easier for you to get started. I hope you find using as fun as I do.

Introduction

Here’s an excellent intro video. You should probably watch this first. There are two parts. http://excess.org/article/2008/07/ogre-git-tutorial/

 
Here’s a nice, short book on how GIT works. You may want to come back to this after you’ve played with the commands for a couple of days. But I do recommend coming back to it. It has lot of explanations that show how git works. I personally read this first. After reading it, I had a great grasp of the concepts which made it easier to memorize the commands.
http://peepcode.com/products/git-internals-pdf

//see my git links on my delicious account (note: there are 3 pages; some of the more useful ones are older links; the newer links are more advanced items, so you may want to skip them for now)
http://www.delicious.com/homer6/git

//Install Git on Ubuntu
sudo apt-get install git-core

 

Finding the Usage

//Run: git <command> –help to see usage on that command
//eg. git push –help

Some Common Commands

git clone -o github_remote https://github.com/jquery/jquery.git

git pull github_remote

git push github_remote github_branch_master

git push –all github_remote

git status

git commit -a -m “Fixed error with homepage not displaying the correct timezone.”

git add -i

 

//warning: destructive (like an svn revert); know what you’re doing first with this.

git reset –hard master

//add this bash alias to your ~/.bashrc file to be able to recursively add empty directories to a repository

alias git_add_empty_dirs=’find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;’

//turns on the shell colors for all working copies

git config –global color.ui always

//makes git status = git st

git config –global alias.st status

//create an alias to easily recursively update the submodules within a project

git config –global alias.subup “submodule update –init –recursive”

More Useful Git Resources

http://progit.org/book/

For people who have used SVN:
http://git.or.cz/course/svn.html

A Simple Workflow for using GIT in small teams
http://toroid.org/ams/git-central-repo-howto

Also, the git official website has a lot of resources…
http://git-scm.com/

Here’s a great article on rebasing:
http://www.randyfay.com/node/91

Leave a Comment