将“submodule”目录中的文件添加到Main Project

时间:2017-08-30 17:49:18

标签: git git-submodules

我正在向项目添加文件夹......其中一些文件夹是git项目。

一般来说,我应该添加“子模块”......但是,对于这个项目,我想忽略这些文件夹是子模块的事实。

即使它们是“子模块”,您如何才添加文件?

我只想'git add -A',提交“消息”并推送。我想保留.git文件夹 - 而不是添加/提交.git文件夹 - 并有效地忽略“子模块”部分。

文件夹:

YYY
 |- .git  <-- Project .git
 |-  ZZZ  <-- Project ZZZ
      |- .git <-- Don't add this
      |- (project files) <-- do add these
 |-  QQQ  <-- just another folder with..
      |-  MMM  <-- Project MMM inside
           |- .git <-- Don't add this
           |- (project files) <-- do add these
 |-  (project files)

1 个答案:

答案 0 :(得分:0)

List all git submodules (one of many answers here)

Private bRunDoDays As Boolean
Sub Copier()
'set to false
bRunDoDays = False
Dim x As String
Dim z As Integer
x = InputBox("Enter Number of Days in Month")
If x = "" Then
     MsgBox "User Pressed Cancel!" & vbCrLf & _
            "or did not enter a value!", vbOKOnly + vbInformation, _
            "Inputbox Result:"
     z = 10
     Exit Sub
ElseIf CInt(x) = 0 Then
     MsgBox "User Pressed Cancel!" & vbCrLf & _
            "or did not enter a value!", vbOKOnly + vbInformation, _
            "Inputbox Result:"
     z = 10
     Exit Sub
Else: End If
y = CInt(x) - 1
For numtimes = 1 To y
ActiveWorkbook.Sheets("Sheet1").Copy _
after:=ActiveWorkbook.Sheets("Sheet1")
Next
'set to true
bRunDoDays = True

End Sub



Private Sub COPY_NUMBER_Click()
COPY_NUMBER.BackColor = 12713921
Copier
If bRunDoDays = False Then Exit Sub
DoDays
COPY_NUMBER.BackColor = 12500670
COPY_NUMBER.Enabled = False
End Sub

result

height: 100%

remove cached entry

html, body { height:100%; }

then add all files in that folder

git ls-files --stage | grep 160000

then add all

160000 fdd0df41eb6271f06711c791af587c614097eedb 0       web/libraries/randomLibrary
....

Wrapped this up in a one-liner for all "submodules".

Hackish, but works for this project.