Installing git on Mac OS 10.5.6

Installing git on Macintosh is simple yet. You have plenty of options. I have choosed to build from source but you can find your own option.

Compiling from source

Download the file "git-1.6.2.1.tar.gz" from git-scm.com. Then compile and install as ususal:

$ tar zxvf git-1.6.2.1.tar.gz $ cd git-1.6.2.1 $ ./configure $ make $ sudo make install Password: $ which git /usr/local/bin/git $ cd /usr/local/bin/ $ ls git* git git-receive-pack git-upload-archive gitk git-cvsserver git-shell git-upload-pack

When using google to find information, I have found these pages interresting:

Configuring git to use TextMate editor

To use TextMate to edit your commit messages, put the following in your ~/.bash_profile or ~/.bash_login:

export GIT_EDITOR="mate -w"

We need to install the TextMate Bundle:

$ mkdir -p /Library/Application\ Support/TextMate/Bundles $ cd !$ $ git clone git://gitorious.org/git-tmbundle/mainline.git Git.tmbundle $ osascript -e 'tell app "TextMate" to reload bundles'

From gitorious.org, I learned that in the TextMate preferences, advanced tab, shell variables, we can set the TM_GIT variable to point to your installation of git (ie /usr/local/bin/git). Many shortcuts are available from the Git-shortcut (Ctrl-Shift-G).

Installing with the git-osx-installer

You can found the git-osx-installer, on this site. I have also found this page to download the installer ("git-1.6.2.1-intel-leopard.dmg") and a small applescript application to open Git Gui (OpenInGitGui-2.0.zip) or information on how to build your own installer.

Git documentation

You can found a lot of links to documentation on the git-scm.com site. The Git Community Book is also usefull. I have also started reading a tutorial for developers. The git user manual is here.

The git command you have to use once

$ git config --global user.name "Philippe Laval" $ git config --global user.email info@www.nice-panorama.com

Creating a cappuccino application and importing the project

$ capp TutorialDocument $ cd TutorialDocument $ git init Initialized empty Git repository in /Users/philippe/Desktop/TutorialDocument/.git/ $ git add . $ git commit A message with vi

To quit vi, you need to type "esc :wq" to write and quit.

Modifing files

$ git add file1 file2 file3 $ git diff --cached $ git status # On branch master nothing to commit (working directory clean) $ git commit [master e38fa9e] Change the title in the html page 1 files changed, 1 insertions(+), 1 deletions(-)

Alternatively, instead of running git-add beforehand, you can use

$ git commit -a

$ git log $ git log -p $ git log --stat --summary

$ git branch experimental $ git branch

$ git checkout experimental (edit file) $ git commit -a $ git checkout master (edit file) $ git commit -a $ git merge experimental

This command ensures that the changes in the experimental branch are already in the current branch.

$ git branch -d experimental

If you develop on a branch crazy-idea, then regret it, you can always delete the branch with

$ git branch -D crazy-idea

GUI and git

$ gitk $ git gui
Copyright © 2009 - Philippe Laval. Cappuccino and Objective-J are registered Trademarks of 280 North.