我在Mac OS X上使用Git。我的项目根目录中有一个文件夹(与“.git”文件夹处于同一级别),我想添加它以便我尝试
localhost:salesproject satishp$ git add -A myfolder1/
warning: CRLF will be replaced by LF in server.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in web/processor.js.
The file will have its original line endings in your working directory.
然而,当我跑
时localhost:salesproject satishp$ git commit -m 'Some changes.'
warning: CRLF will be replaced by LF in server.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in web/processor.js.
The file will have its original line endings in your working directory.
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: myfolder1 (modified content)
no changes added to commit
尽管此文件夹中有更改。遵循这个建议 - git add -A is not adding all modified files in directories,我尝试了这个
localhost:salesproject satishp$ git submodule foreach --recursive git add -A .
Entering 'myfolder1'
No submodule mapping found in .gitmodules for path 'myfolder1'
但是当我尝试提交时仍然会遇到相同的错误。如何将我的目录添加到我的Git项目?
编辑:以下是我运行“git status”
时会发生什么localhost:salesproject satishp$ git status myfolder1/
warning: CRLF will be replaced by LF in server.js.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in web/processor.js.
The file will have its original line endings in your working directory.
On branch master
Your branch is up-to-date with 'origin/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: myfolder1 (modified content)
no changes added to commit (use "git add" and/or "git commit -a")
答案 0 :(得分:0)
您的问题可能实际上是这样的:
No submodule mapping found in .gitmodules for path 'myfolder1'
然后执行git rm --cached myfolder1
然后你应该可以
git add myfolder1 ; git commit -m "etc"
(只是转录评论中的回复)