Как добавить папку в существующий проект git в корне проекта? - PullRequest
0 голосов
/ 14 мая 2018

Я использую 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 Ответ

0 голосов
/ 15 мая 2018

Возможно, проблема заключается в следующем: No submodule mapping found in .gitmodules for path 'myfolder1'

  1. В некоторых статьях, которые я нашел, нужно выполнить обновление / инициализацию обновления подмодуля git-подмодуля --init (выполните pls RTFM перед использованием: git-scm.com/docs/git-submodule);
  2. Затем выполните git rm --cached myfolder1

  3. После этого вы сможете git add myfolder1 ; git commit -m "etc"

(просто расшифровка ответа от комментариев)

...