Как добавить папку в существующий проект git в корне проекта?
Я использую Git на Mac OS X. У меня есть папка в корне моего проекта (на том же уровне, что и папка ".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 не добавляет все измененные файлы в каталоги, я попробовал это
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")
1 ответ
Вы проблема может быть на самом деле это:No submodule mapping found in .gitmodules for path 'myfolder1'
- В некоторых статьях, которые я нашел, нужно выполнить обновление / инициализацию обновления подмодуля git подмодуля git --init (выполните pls RTFM перед использованием: git-scm.com/docs/git-submodule);
Тогда сделай
git rm --cached myfolder1
Вы должны быть в состоянии
git add myfolder1 ; git commit -m "etc"
(просто расшифровка ответа от комментариев)