2011-03-28 25 views
3

我是GIT的新手,并且一直在努力。我有一个存储在存储库中的网站。该网站需要一个设置为单独存储库的主题文件夹。将本地回购推送到远程不会使用GIT推子模块文件

我已经成功使用git submodule add命令将主题存储库添加到我的网站。

所以现在我有一个网站repro与主题子repro。子模块的文件显示在我的网站文件夹中。

我试图推动整个主网站repro到远程服务器工作,但主题(子模块)的文件不推动。

+0

你的意思是“repo”而不是“repro”? – 2011-03-29 16:55:41

回答

2

该子模块非常像独立的存储库 - 它不知道它是否作为子模块包含在父存储库中。父库不太了解子模块 - 它应该在树中的哪个位置,子模块应该在哪个位置以及最初从哪个URL克隆它...

我不认为还有,这将推动你的所有子模块的命令 - 事件序列,当你更新辅助模块的某些文件应该是:

cd theme 

# [Change or add some files, etc.] 

# Now commit those changes: 
git commit -a 

# Push them to the origin repository, assuming you're on the master branch: 
git push origin master 

# Change up to the parent repository: 
cd .. 

# Create a commit with the new version of that submodule: 
git add theme 
git commit -m "Committing a new version of the theme submodule" 

# Now push the commit that includes a pointer to the new submodule 
# version in the parent repository: 
git push origin master 

典型的问题这里正在推动在引用一个子模块的父版本库提交版本,您尚未从子模块版本推送。您可能会发现创建脚本以帮助您不会忘记任何这些步骤。

0

我只是将主题目录添加为远程 - 而不是子模块。在你自己的分支中管理文件的位置。主题的后续更新应移至正确的文件夹。

推送现在将按照您的初始设计进行操作。

希望这会有所帮助。