A new Rails App and Git

March 19th, 2009 . Posted in Uncategorized.

I’ve always got confuse (4get neng na) when mostly starting a new rails app and have it configured to work with git. So here’ s a quick note to remember:

new rails app:

1
$> sudo rails my_new_app

Then add a git to it:

1
2
$> cd my_new_app
$> sudo git init

Then just tell git who were are:

1
$>git config --global user.name "Your Name"; git config --global user.email "your@email.com"

Tell git to ignore some files and folders
at application root create .gitignore file containing:

1
2
$> sudo touch .gitignore
$> sudo vim .gitignore

and you may add the following to .gitignore

1
2
3
4
5
log/*.log
tmp/**/*
.DS_Store
doc/api
doc/app

Create some more .gitignore files so the empty directories get tracked:

1
2
$> touch log/.gitignore
$> touch tmp/.gitignore

and commit:

1
2
$ git add .
$ git commit -m "initial Rails app"

That’s it!

Leave a Reply