Saturday, March 15, 2008

Setup GIT for Rails


GIT is a popular version control system designed to handle very large projects with speed and efficiency; it is used mainly for various open source projects, most notably the Linux kernel. Git falls in the category of distributed source code management tools, similar to e.g. GNU Arch or Monotone (or BitKeeper in the proprietary world). Every Git working directory is a full-fledged repository with full revision tracking capabilities, not dependent on network access or a central server. Basically it Rocks.

I am on a Linux box so this is what I need to install GIT

sudo apt-get install git-tk git-svn git-email git-doc git-cvs git-core git-arch

once this is done you can test the GIT setup by typing GIT in the terminal. You should typically get this output.

So now your GIT is up and ready to fire. Now navigate to your rails project folder. Follow these steps to create your repository:
  1. Initialize a new git repo
  2. Create a .gitignore for files git should ignore while committing
  3. Default values for a .gitignore
  4. In case you don't see a /log /vendor /tmp | note use sudo(super user) if these directories are already created but are empty
  5. Commit your files in the repo | again do this from the home of the project
  6. You can check the status of the repo

// Initialize a new git repo
git init
//Create a .gitignore for files git should ignore while committing
touch .gitignore
//Default vaules for a .gitignore
DS_Store
log/*.log
tmp/**/*
config/database.yml
//In case you dont see a /log /vendor /tmp | note use sudo if these directories are already created but are empty
touch /log .gitignore /vendor .gitignore /tmp .gitignore
//Adding your files for the repo | do this from the home of the project
git add .
//Commit your files in the repo | again do this from the home of the project
git commit -a -m "Some message here... mostly the reason to commit"
//You can check the status of the repo
git status

And that pretty much covers the basics. Till the next time.... peace

=================================================
||My FREE services||

ParkingWHOIS is now not only a domain parking lookup, but now also has reviews on Parking Companies.
=================================================