0

I read in tutorial that you can use git commit -a -m "comment" as a short hand to

$ git add .
$ git commit -m "comment"

when I trying to run this command I am facing following issue

Ashishs-MacBook-Pro:ourfirstrepo atyagi$ git commit -a -m "adding second file"
On branch work
Untracked files:
(use "git add <file>..." to include in what will be committed)
    sample2.txt
nothing added to commit but untracked files present (use "git add" to track)

could some one please explain why git commit -a -m is not working

Nevik Rehnel
  • 49,633
  • 6
  • 60
  • 50
Ashish
  • 14,295
  • 21
  • 82
  • 127

2 Answers2

4

'git commit -a' adds all tracked files to the commit. Because these files are untracked, you will have to explicitly add them once, before you can use the -a flag.

MicroVirus
  • 5,324
  • 2
  • 28
  • 53
2

The -a adds all of the tracked files only. It ignores the untracked files.

http://linux.die.net/man/1/git-commit

Schleis
  • 41,516
  • 7
  • 68
  • 87