2011-05-12 31 views
1

我一直在最近摆脱git submodules的过程。有时我会在有子模块的地方添加新文件。如何用代码中的自动代码替换git子模块?

我正在寻找一种很好的方式来删除一个子模块,并在它的位置添加一些文件,而不会产生合并问题来拉取用户。

这里就是我说的:

这是一个承诺,我已经删除的子模块定义和增加了一些文件作为替代:

$:~/src/github/huerlisi/mailyt$ git show d1e7e1276fdccb37f775c8f656077e490a0b7be8 
commit d1e7e1276fdccb37f775c8f656077e490a0b7be8 
Author: Simon Hürlimann (CyT) <[email protected]> 
Date: Wed May 11 22:07:49 2011 +0200 

    Vendor in formtastic sass, drop git submodule. 

diff --git a/.gitmodules b/.gitmodules 
index 24f8f38..e6177d1 100644 
--- a/.gitmodules 
+++ b/.gitmodules 
@@ -1,6 +1,3 @@ 
[submodule "vendor/plugins/fetcher"] 
     path = vendor/plugins/fetcher 
     url = git://github.com/huerlisi/fetcher.git 
-[submodule "app/stylesheets/partials/formtastic"] 
-  path = app/stylesheets/partials/formtastic 
-  url = git://github.com/activestylus/formtastic-sass.git 
diff --git a/app/stylesheets/partials/formtastic b/app/stylesheets/partials/formtastic 
deleted file mode 160000 
index 1b920cb..0000000 
--- a/app/stylesheets/partials/formtastic 
+++ /dev/null 
@@ -1 +0,0 @@ 
-Subproject commit 1b920cb2db627cb7cf11cf4d3cea373a774a6fd3 
diff --git a/app/stylesheets/partials/formtastic/_formtastic_base.sass b/app/stylesheets/partials/formtastic/_formtastic_base.sass 
new file mode 100644 
index 0000000..b01ac8e 
--- /dev/null 
+++ b/app/stylesheets/partials/formtastic/_formtastic_base.sass 
@@ -0,0 +1,652 @@ 
+// 
+// FORMTASTIC SASS 
+// Flexible styling for formtastic forms 

合并这个承诺与我的工作目录子模块签出给出了这样的错误:

~/src/github/huerlisi/mailyt$ git pull 
remote: Counting objects: 35, done. 
remote: Compressing objects: 100% (23/23), done. 
remote: Total 24 (delta 16), reused 0 (delta 0) 
Unpacking objects: 100% (24/24), done. 
From github.com:huerlisi/mailyt 
    2d055d6..82a45be master  -> origin/master 
* [new branch]  notmuch -> origin/notmuch 
Updating 2d055d6..82a45be 
error: The following untracked working tree files would be overwritten by merge: 
     app/stylesheets/partials/formtastic/_formtastic_base.sass 
Please move or remove them before you can merge. 
Aborting 

合并作品之前,手动删除应用/样式表/谐音/ formtastic目录。但是,我希望我的同行编码人员能够简单地进行拉取和编码。

回答

2

没有什么可以为你做的。由于子模块是具有参考日志和历史记录的完整存储库,所以拉不会消除它们。合并也不会。他们将不得不对他们进行明确室射频时,他们得到的这些变化。这是由设计救人不经意地擦拭自己的工作和/或引用日志等

希望这有助于

+0

好,你告诉我我期待什么。我仍然希望有一个丑陋的黑客...所以你将不得不等待一天左右'直到我最终接受你的答案(不要拍信使,他们说:-) – 2011-05-12 08:14:58

+1

强迫他们克隆并合并他们原有回购的任何变更。对于这些回购,子模块从来不存在,并且您避免了这个问题 – 2011-05-12 15:54:34

+0

看起来像(特别是丢弃)子模块需要在回购站旁边有一个额外的通信通道。就这样吧:-) – 2011-05-12 17:30:28