# Adding files in git

**URL:** <https://www.ruby-forum.com/t/adding-files-in-git/165013>\
**Category:** Rails\
**Created:** [April 8, 2009, 9:02am UTC](https://www.ruby-forum.com/t/adding-files-in-git/165013 "2009-04-08T09:02:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 8, 2009, 9:02am UTC](https://www.ruby-forum.com/t/adding-files-in-git/165013/1 "2009-04-08T09:02:07Z")

</div>

Do I need to add each new file in git that is created after init?

Or does it happen when I do “git commit -a -v -m ‘test’”?

If so, can I just use “git .” and it will take new files and skip old  
ones?

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 8, 2009, 9:36am UTC](https://www.ruby-forum.com/t/adding-files-in-git/165013/2 "2009-04-08T09:36:05Z")

</div>

You have to add files to git with:

git add .

This will add all new files. Command

git commit -a -m ‘…’

with add only already tracked and changed files and commit them with  
given message.

On Apr 8, 9:02 am, Pål Bergström [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 8, 2009, 9:44am UTC](https://www.ruby-forum.com/t/adding-files-in-git/165013/3 "2009-04-08T09:44:16Z")

</div>

Bosko I. wrote:

> You have to add files to git with:
> 
> git add .
> 
> This will add all new files. Command
> 
> git commit -a -m ‘…’
> 
> with add only already tracked and changed files and commit them with  
> given message.
> 
> On Apr 8, 9:02ï¿½am, Pï¿½l Bergstrï¿½m [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 8, 2009, 7:10pm UTC](https://www.ruby-forum.com/t/adding-files-in-git/165013/4 "2009-04-08T19:10:30Z")

</div>

PÃ¥l BergstrÃ¶m wrote:

> Bosko I. wrote:
> 
> > You have to add files to git with:
> > 
> > git add .
> > 
> > This will add all new files. Command
> > 
> > git commit -a -m ‘…’
> > 
> > with add only already tracked and changed files and commit them with  
> > given message.
> > 
> > On Apr 8, 9:02ï¿½am, Pï¿½l Bergstrï¿½m [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> Thanks 🙂

Also note that git add --all does what git add . does, but this form  
might only attempt to add modified and untracked files, rather than  
attempting to add every file in the project. I don’t know if it actually  
matters though in practice.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 8, 2009, 7:21pm UTC](https://www.ruby-forum.com/t/adding-files-in-git/165013/5 "2009-04-08T19:21:33Z")

</div>

Robert W. wrote:

> PÃ¥l BergstrÃ¶m wrote:

> Also note that git add --all does what git add . does, but this form  
> might only attempt to add modified and untracked files, rather than  
> attempting to add every file in the project. I don’t know if it actually  
> matters though in practice.

I see. Good to know.
