Roy
Roy

Reputation: 69

Git is not adding files

I am trying to add some files to the staging area. But git isn't responding. What am I doing wrong?

This is what I get when I am querying for the current status

(web) roy@desktopL:~/Workspace/kpr-admin-db$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    .~lock.callLog.csv#
        modified:   db.sqlite3
        modified:   dbaccess/models.py
        modified:   dbaccess/models.pyc
        modified:   volunteers.csv

    Untracked files:
      (use "git add <file>..." to include in what will be committed)

        dbController.py

    no changes added to commit (use "git add" and/or "git commit -a")

When I'm trying to add

(web) roy@desktopL:~/Workspace/kpr-admin-db$ git add *
The following paths are ignored by one of your .gitignore files:
dbController.pyc
Use -f if you really want to add them.
fatal: no files added

Any help is appreciated. Thanks.

Upvotes: 0

Views: 938

Answers (3)

CodeWizard
CodeWizard

Reputation: 141946

First of all to add all files you have to use:

# add new, removed and updated files
# -A is alias for `git add . && git add -u`
git add -A .

Note

With Git 2.0, git add -A is default.

Copied from the above release notes:

git add <path> is the same as git add -A <path> now, so that git add dir/ will notice paths you removed from the directory and record the removal. In older versions of Git, git add <path> used to ignore removals. You can say git add --ignore-removal <path> to add only added or modified paths in , if you really want to.


In your case you have the file in your .gitignore file so you have to remove it from the file.

Upvotes: 2

Shravan40
Shravan40

Reputation: 9888

If you want to add recently created, deleted and updated files, use git add -A

Note : git add -A do not add files which are mentioned in .gitignore. You have to remove it from there.

Upvotes: 1

George Chen
George Chen

Reputation: 6939

Use the followings instead

git add .   

or

git add --all  

refert this answer

Upvotes: 1

Related Questions