将文件夹添加到git

时间:2015-06-28 00:42:55

标签: git

我想将整个文件夹结构添加到git。主文件夹(我运行git init)包含一些文件和一个所有源所在的文件夹。 git init只添加了直接在这个根文件夹中的文件,将子文件夹标记为子模块。我不希望它成为子模块。如何将整个结构添加到我的git仓库?

$ 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:   MySubfolder (modified content, untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git add MySubfolder/*
fatal: Path 'MySubfolder/file1.py' is in submodule 'MySubfolder'

1 个答案:

答案 0 :(得分:0)

在这种情况下最简单的事情就是重新开始。将文件复制到临时目录,删除存储库目录,再次运行git init,然后将其复制回来。 git add之后会正常工作。