Wednesday, August 6, 2008

Installing GIT on Windows (msysGit)

GIT is fast evolving revision control software created by Linus Torvalds, the initial developer of Linux. GIT was written to be a replacement to BitKeeper, a proprietary version management system that was initially used during the development of Linux.

Although GIT was originally meant for the Linux platform, ever since it became popular, there have been GIT versions for Windows and OS X as well. This post describes a GIT installation on windows.

The recommended installation on windows(called msysGit) requires Cygwin to be installed on your windows machine. GIT over Cygwin could be slower than GIT on Linux; nevertheless its good enough for those who would like to get a feel of GIT on their windows machines.

Below are the installation and configuration steps
1. Install Cygwin -
http://www.cygwin.com/setup.exe has a setup file of around 500KB which will in turn direct you to mirror sites for the rest of cygwin libraries.

2. Download and Install GIT for windows
http://code.google.com/p/msysgit/downloads/list
The installation asks whether GIT needs to be tightly coupled with your windows machine. I chose the loosely coupled GIT-bash option(this option does not support explorer integration).

3. To start experimenting, you could clone an existing GIT repository (similar to making a new module in CVS). I chose to experiment using a clone of script.aculo.us from github
Here's how you would create a clone
git clone git://github.com/madrobby/scriptaculous.git

The above clone created a directory called "scriptaculous" with a local copy of script.aculo.us code. There's also this special folder .git which has GIT metadata/history for the project.

Saved modifications in the GIT repository are called "commits".
"git show" displays information about the latest commit.
Commits are uniquely identified using a SHA1 hashed value of the file's contents (In the above example - a71412...bf94a4)

"git branch" lists all branches in the project. In the below example there's just one master branch.

4. Creating a test GIT project
a. Configure GIT using the .gitconfig file
b. Create and initialize a GIT repository
c. Add files and commit
For an in-depth reference on using GIT see http://www.kernel.org/pub/software/scm/git/docs/user-manual.html

0 comments: