撤消子模块并使其成为 github 存储库的目录

undo submodule and make it a directory to a github repository

我从 github 克隆了一个存储库,我想让它成为另一个 github 存储库中的一个目录。虽然它被认为是一个子模块(我不希望它是一个子模块,而是一个目录)。 在这个目录中,我有一些脚本,我想将其推送到我的 github 存储库中。

当我这样做时:git status 我收到此错误消息:

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:   my_directory (untracked content)

no changes added to commit (use "git add" and/or "git commit -a")

我试过git add .git add my_directory 并提交它,但它也不起作用。

我没有找到任何 .gitignore 或 .gitmodules...

编辑:

终于我找到了如何做我想做的事,我不得不删除目录中的 .git。虽然它是一个不可见的文件...... 完成后,我只需要做 git commit -a 然后 git push

如果该目录中有一个 .git/ 子文件夹,它将作为一个嵌套的 git 存储库。

如果您添加该文件夹,您实际上只是将 添加到您的存储库,而不是文件夹内容。

撤消:

git rm --cached my_directory

(非常重要:没有尾部斜杠:您要删除条目,而不是文件夹内容)

如果不在意历史内容,删除my_directory/.git

然后您可以像往常一样添加、提交和推送:该文件夹将是一个常规文件夹。