使用子模块的原因:因为很多工程,会有很多相同的代码,每个工程都复制一遍,会很不合适。像Svn可以指定某个目录对应的checkout很方便,对于git也有这样的sub module功能。使用node开发,不需要将它放到npm上面。
客户端我用的是Tortoise git,新建一个git库后,再把另个一个git做为子模块,结果发现修改子模块总是不能提交。
报错如下:
git.exe push --progress "origin" develop:develop
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 607 bytes | 607.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: refusing to update checked out branch: refs/heads/develop
remote: error: By default, updating the current branch in a non-bare repository
remote: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository