2

When I enter in console:

$   git add .

I get:

Nothing added Nothing Specified. May be you wanted to say 'git add.'?

random
  • 9,774
  • 10
  • 66
  • 83
neha
  • 63
  • 3
  • 3
  • 8

5 Answers5

4

Try this: $ git commit -am "Your commit message"

Deepak Biswal
  • 4,280
  • 2
  • 20
  • 37
2

There is nothing to commit

if git add . doesn't do anything there are two possibilities:

  • the directory you are in is empty
  • Everything in the folder is already tracked and hasn't changed OR is ignored

e.g. with an empty folder:

$ git add .
$ git status
# On branch master
#
# Initial commit
#
$ ls -la
drwxrwxr-x  3 andy andy 4096 Aug 26 11:34 .
drwxrwxrwt 11 andy andy 4096 Aug 26 11:34 ..
drwxrwxr-x  7 andy andy 4096 Aug 26 11:34 .git

Or, if everything is already tracked and unchanged:

$ touch foo
$ git add foo
$ git commit -m "adding foo"
[master (root-commit) d27092b] adding foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo
$ git add .
$ git status
# On branch master
nothing to commit, working directory clean
$ ls -la
drwxrwxr-x  3 andy andy 4096 Aug 26 11:34 .
drwxrwxrwt 11 andy andy 4096 Aug 26 11:34 ..
-rw-rw-r--  1 andy andy    0 Aug 26 11:35 foo
drwxrwxr-x  7 andy andy 4096 Aug 26 11:34 .git

Note that git status did not report any changes.

Ignored?

If a file/folder is ignored git will, well, ignore it :)

However you can still add it explicitly:

$ echo "bar" > .gitignore
$ touch bar
$ git add bar
The following paths are ignored by one of your .gitignore files:
bar
Use -f if you really want to add them.
fatal: no files added
$ git add -f bar
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   new file:   bar
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .gitignore
$
Community
  • 1
  • 1
AD7six
  • 63,116
  • 12
  • 91
  • 123
2

Try git add -A. This should add all to staging area (new files etc.)

From manual:

Like -u, but match against files in the working tree in addition to the index. That means that it will find new files as well as staging modified content and removing files that are no longer in the working tree.

jasir
  • 1,461
  • 11
  • 28
0

The order should look like this:

1) start a branch: git checkout -b my_cool_branch
2) do stuff on that branch
3) add the things you've changed to your commit queue: git add .
4) commit the things you added to your queue: git commit -m "i'm adding stuff!"

(optionally)
5) switch back to master (or whatever your main branch is): git checkout master
6) push your local commits to your github: git push origin master

The error you're seeing makes me think that you've skipped step 2 - are you sure you've made changes? run git status to see tracked/untracked changes.

dax
  • 10,779
  • 8
  • 51
  • 86
  • @ dax i am pretty new to git.i have complete 2 task.now i want to commit both these task......these are the instructions given to me to commit.........please check this : Say the ticket number you are working ins AS-3 then your git commits should be as below git add . git commit -am "AS3 - Description of change" git push origin master – neha Aug 26 '13 at 09:40
  • type `git status` - what does that give you? – dax Aug 26 '13 at 09:43
-1

Use the git commit

$ git commit -m "Yeah am saving it!."
Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126