# GIT Procedure with Rails

**URL:** <https://www.ruby-forum.com/t/git-procedure-with-rails/132945>\
**Category:** Rails\
**Created:** [March 25, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/git-procedure-with-rails/132945 "2008-03-25T23:55:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karlshea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/58956e/32.png) [@karlshea](https://www.ruby-forum.com/u/karlshea)\
**Post date:** [March 25, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/git-procedure-with-rails/132945/1 "2008-03-25T23:55:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![karlshea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/58956e/32.png) [@karlshea](https://www.ruby-forum.com/u/karlshea)\
**Post date:** [March 26, 2008, 12:37am UTC](https://www.ruby-forum.com/t/git-procedure-with-rails/132945/2 "2008-03-26T00:37:45Z")

</div>

On 25 Mar 2008, at 23:54, Karl S. wrote:

> 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

---

<div class="post-metadata">

**Author:** ![karlshea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/58956e/32.png) [@karlshea](https://www.ruby-forum.com/u/karlshea)\
**Post date:** [March 26, 2008, 2:42am UTC](https://www.ruby-forum.com/t/git-procedure-with-rails/132945/3 "2008-03-26T02:42:09Z")

</div>

On Tue, Mar 25, 2008 at 6:54 PM, Karl S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Just started a new project and I’ve decided to give GIT a whirl to see  
> if I like it.
> 
> Seems like ‘git add .’ is a lot easier and makes committing quicker.
> 
> Good? Bad? A better way?  
> 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. 🙂

–wpd
