2013-10-15 58 views
0

我想添加提交文件使用「git add」。但文件沒有被添加!「git add」。是不是在階段區域添加文件

這是我的 「混帳地位」 輸出:

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的補充。然後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") 

這是我第一次遇到這個問題。難道我做錯了什麼?

+0

看起來你再次輸入'git status'。嘗試'git add ../' –

+1

Unix中的'.'表示當前目錄。當你輸入'git add .'時,你告訴git在當前目錄中添加所有的改變。看起來您在當前目錄中沒有任何更改,但在父目錄中沒有任何更改。 unix中的'..'表示父目錄。 – Munim

回答

3

是不是因爲修改過的文件不在當前目錄中? git add .會將當前目錄中的文件添加到暫存區域。

如果你這樣做git add ../這應該很好。

+0

是的,這是問題。我現在就想到了。謝謝! –

相關問題