?
本文檔使用 php中文網手冊 發(fā)布
名稱
gitmodules - 定義子模塊屬性
$GIT_WORK_DIR/.gitmodules
.gitmodules
文件位于 Git 工作樹的頂層目錄中,是一個文本文件,其語法與 git-config [1] 的要求相匹配。
文件包含每個子模塊的一個子部分,并且子部分值是子模塊的名稱。名稱被設置為子模塊已被添加的路徑,除非它是用--name
選項自定義的git submodule add
。每個子模塊部分還包含以下必需的鍵:
submodule.<name>.path
定義相對于 Git 工作樹的頂級目錄的路徑,其中子模塊預計將簽出。路徑名稱不能以/
。所有子模塊路徑在 .gitmodules 文件中必須是唯一的。
submodule.<name>.url
定義可從中克隆子模塊存儲庫的URL。這可能是一個準備好傳遞給 git-clone [1] 或者(如果它以./或../開頭)相對于超級項目的源存儲庫的位置的絕對 URL。
另外,還有一些可選的鍵:
submodule.<name>.update
定義指定子模塊的默認更新過程,即通過超級項目中的 “git submodule update” 命令更新子模塊的方式。這僅用于git submodule init
初始化相同名稱的配置變量。這里允許的值是checkout
,rebase
,merge
或none
。有關update
它們的含義,請參閱 git-submodule [1] 中的命令說明。請注意,!command
出于安全原因,表單在此處被故意忽略。
submodule.<name>.branch
用于跟蹤上游子模塊中更新的遠程分支名稱。如果該選項未指定,則默認為master
。特殊值.
用于指示子模塊中分支的名稱應與當前存儲庫中當前分支的名稱相同。有關--remote
詳細信息,請參閱
git-submodule [1] 中的文檔。
submodule.<name>.fetchRecurseSubmodules
選項可用于控制此子模塊的遞歸提取。如果此選項也存在于超級項目的 .git / config 子模塊條目中,那么該設置將覆蓋. gitmodules 中的設置。通過在 “git fetch” 和 “git pull” 中使用 “--no-recurse-submodules” 選項,可以在命令行上覆蓋這兩個設置。
submodule.<name>.ignore
定義在什么情況下,“git status” 和 diff 系列顯示已修改的子模塊。支持以下值:
all
子模塊永遠不會被視為已修改(但仍會顯示在狀態(tài)的輸出中,并在已上載時進行提交)。
dirty
對子模塊工作樹的所有更改都將被忽略,只會考慮子模塊的 HEAD 與其在超級項目中記錄的狀態(tài)之間的差異。
untracked
子模塊中只有未跟蹤的文件將被忽略。承諾的差異和修改被跟蹤的文件將顯示出來。
none
沒有對子模塊的修改被忽略,所有提交的差異以及對跟蹤和未跟蹤文件的修改都會顯示出來。這是默認選項。
If this option is also present in the submodules entry in .git/configof the superproject, the setting there will override the one found in.gitmodules.Both settings can be overridden on the command line by using the"--ignore-submodule" option. The 'git submodule' commands are not affected by this setting.
submodule.<name>.shallow
設置為 true 時,此子模塊的克隆將作為淺層克?。v史深度為1)執(zhí)行,除非用戶明確要求使用非淺層克隆。
考慮下面的 .gitmodules 文件:
[submodule "libfoo"] path = include/foo url = git://foo.com/git/lib.git
[submodule "libbar"] path = include/bar url = git://bar.com/git/lib.git
這定義了兩個子模塊,libfoo
和libbar
。這些預計的路徑要被檢出的include/foo
和include/bar
,并為兩個子模塊被指定一個URL可以用于克隆子模塊。