如何删除git子模块残骸?

时间:2013-12-17 06:09:33

标签: git github git-submodules

在将我的代码历史记录推送到git存储库时,我发现Objective-C项目作为子模块工作,这意味着如果我推送Objective-C项目,它就像子模块一样工作,如this

在我注意到该因素后,我尝试重新初始化我的 .git 文件夹。 (删除并尝试调用'git init')

但它根本不起作用,子模块仍然存在。

我还尝试了 git submodule deinit init 命令。但是,在那之后,即使我试图将我的文件推送到git存储库,它也会抛弃此消息。

Sogos-Macbook:Test code dkswogus7530$ git push -u origin master

To https://github.com/JaehyunAhn/cpuls2_book_review.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/JaehyunAhn/cpuls2_book_review.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我还尝试更新&删除我的git存储库以输入命令 git pull origin master ,该命令将中止此消息

Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 537 bytes | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: error: object d5c202897cf6f769235a2707d15719636fe37984:contains duplicate file entries
remote: fatal: Error in object
error: unpack failed: index-pack abnormal exit
To https://github.com/JaehyunAhn/cpuls2_book_review.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'https://github.com/JaehyunAhn/cpuls2_book_review.git'

如何解决此问题?

submodule repository指向thisthisthis

1 个答案:

答案 0 :(得分:1)

如果所有其他方法都失败了,你真的只想重新开始,为什么不进入repo和每个子模块然后:

rm -rd .git