GIT Procedure with Rails

Just started a new project and I've decided to give GIT a whirl to see
if I like it.

The first thing that has me stumbling a little is the best way to add
files to a git repository when you generate a new model/scaffold/
controller. Let's say I add a new scaffold, which creates a dozen
files or so. I know I can 'git add path/to/file' for each new file.
Could I just 'git add .' instead?

Seems like 'git add .' is a lot easier and makes committing quicker.

Good? Bad? A better way?

git add . will just queue any new and modified files in the current for commit. If that’s what you’re looking into doing, there’s nothing wrong with it.

Best regards

Peter De Berdt

That's what I've been doing. If this is your first experience with
git, you might be surprised to learn that git does not track empty
directories, which may cause you some grief if you plan on cloning
your repository. A workaround, given in the git FAQ, is to place an
empty .gitignore file in those directories. I've started doing this:

$ find . -type d -empty -exec touch {}/.gitignore \;

Then, as long as I'm fiddling with .gitignore files, I put "*.log"
into log/.gitignore. I put "*.sqlite3" in db/.gitignore. (I've only
ever played with sqlite3 databasen.) Finally, being a big fan of
Emacs, I put "*~" into the top level .gitignore file. (If you are
unfamiliar with Emacs, it saves backup files with a "~" extension.)

I do all of this just after executing:

$ rails new_app
$ cd new_app

and before executing
$ git init
$ git add .
$ git commit -m "Create new RoR app"

and is based on a whole week or two worth of experience with rails. :slight_smile:

--wpd