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
  • 45,305
  • 6
  • 59
  • 49
Ashish
  • 13,655
  • 19
  • 73
  • 118

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,274
  • 2
  • 27
  • 50
2

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

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

Schleis
  • 37,924
  • 7
  • 65
  • 84