0

我正在尝试使用“git add”添加要提交的文件。但文件没有被添加!

这是我的“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")

这就是我在git add 之后得到的。然后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")

这是我第一次面临这个问题。难道我做错了什么?

4

1 回答 1

3

是不是因为修改后的文件不在当前目录下?git add .将当前目录中的文件添加到暂存区。

如果你这样做git add ../应该可以正常工作。

于 2013-10-15T06:26:28.223 回答