简体   繁体   中英

“git add .” is not adding the files in the staged area

I am trying to add the files for commit using "git add ." but the files are not getting added!

This is the output of my "git status" :

 git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   ../bharat-mitra-todo.txt
#   modified:   ../config/main.php
#   modified:   ../controllers/SiteController.php
#   modified:   esearch (modified content, untracked content)
#   modified:   ../views/feedback/index.php
#   modified:   ../views/layouts/main.php
#   modified:   ../views/site/sitemap.php
#   modified:   ../views/user/admin.php
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   ../modules/rights/
no changes added to commit (use "git add" and/or "git commit -a")

And this is what I get after git add . and then git status

SAME OUTPUT AS ABOVE!!

git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   ../bharat-mitra-todo.txt
#   modified:   ../config/main.php
#   modified:   ../controllers/SiteController.php
#   modified:   esearch (modified content, untracked content)
#   modified:   ../views/feedback/index.php
#   modified:   ../views/layouts/main.php
#   modified:   ../views/site/sitemap.php
#   modified:   ../views/user/admin.php
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   ../modules/rights/
no changes added to commit (use "git add" and/or "git commit -a")

This is the first time I am facing this problem. Am I doing something wrong?

Is it not because the modified files are not in the current directory? git add . will add the files in the current directory to the staging area.

If you do git add ../ this should work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM