# commit all the untracked files prior adding them to stage using "git add"

2 messages from 2014-05-17 to 2014-05-18. Participants: Arup Rakshit, Tanay Abhra.
Thread: https://gitlist.dev/t/36686

## Arup Rakshit, 2014-05-17 18:28

Subject: commit all the untracked files prior adding them to stage using "git add"
Message-ID: <1878681.dTqGrk8buZ@linux-wzza.site>
URL: https://gitlist.dev/e/1878681.dTqGrk8buZ%40linux-wzza.site

```
Here is the currently added files in my repository :

arup@linux-wzza:~/Rails/test_app> git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
#       Gemfile
#       Gemfile.lock
#       README.rdoc
#       Rakefile
#       app/
#       bin/
#       config.ru
#       config/
#       db/
#       lib/
#       log/
#       public/
#       test/
#       vendor/
nothing added to commit but untracked files present (use "git add" to track)

Now I am looking for a way to add those in stage and commit also in a single 
line. So I did below :-

arup@linux-wzza:~/Rails/test_app> git commit -m "chapter 19 of Agile Web 
Development with Rails" -a
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .gitignore
#       Gemfile
#       Gemfile.lock
#       README.rdoc
#       Rakefile
#       app/
#       bin/
#       config.ru
#       config/
#       db/
#       lib/
#       log/
#       public/
#       test/
#       vendor/
nothing added to commit but untracked files present (use "git add" to track)

It did not work. Then using `git commit -h` told me, *-a* will work, for 
*tracked files*. Is there any way to add untracked files in stage, and commit in 
a single line ? 


-- 
===============
Regards,
Arup Rakshit

```

## Tanay Abhra, 2014-05-18 04:17

Subject: Re: commit all the untracked files prior adding them to stage using "git add"
Message-ID: <loom.20140518T060536-509@post.gmane.org>
URL: https://gitlist.dev/e/loom.20140518T060536-509%40post.gmane.org
In-Reply-To: <1878681.dTqGrk8buZ@linux-wzza.site>

```
Arup Rakshit <aruprakshit <at> rocketmail.com> writes:


> Now I am looking for a way to add those in stage and commit also in a single 
> line. So I did below :-
> 
> arup <at> linux-wzza:~/Rails/test_app> git commit -m "chapter 19 of Agile Web 
> Development with Rails" -a
> # On branch master
> #
> # Initial commit
> #
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> #       .gitignore
> #       Gemfile
> #       Gemfile.lock
> #       README.rdoc
> #       Rakefile
> #       app/
> #       bin/
> #       config.ru
> #       config/
> #       db/
> #       lib/
> #       log/
> #       public/
> #       test/
> #       vendor/
> nothing added to commit but untracked files present (use "git add" to track)
> 
> It did not work. Then using `git commit -h` told me, *-a* will work, for 
> *tracked files*. Is there any way to add untracked files in stage, and
commit in 
> a single line ? 
> 

Hi,

git commit -a works for only modified or deleted files, but new files that
you haven't told git about are not affected. What you want is,

$ git add -A && git commit -m "your message"

where git add -A adds all new files to the staging area to track.
A piece of advice, you seem to be new to git, try try.github.com/ for
an interactive tutorial.

Cheers,
Tanay Abhra.

```
