亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
characters

Name

gitsubmodules  - 在另一個(gè)倉(cāng)庫(kù)中安裝一個(gè)倉(cāng)庫(kù)

概要

.gitmodules, $GIT_DIR/config
git submodule
git <command> --recurse-submodules

描述

子模塊是嵌入在另一個(gè)存儲(chǔ)庫(kù)內(nèi)的存儲(chǔ)庫(kù)。子模塊有其自己的歷史; 它所嵌入的存儲(chǔ)庫(kù)稱為超級(jí)項(xiàng)目。

在文件系統(tǒng)上,子模塊通常(但并不總是 - 見下面的表格)由(i)位于$GIT_DIR/modules/其超級(jí)項(xiàng)目目錄下的 Git 目錄,(ii)超級(jí)項(xiàng)目工作目錄內(nèi)的工作目錄以及.git根目錄下的文件指向(i)的子模塊工作目錄。

假設(shè)子模塊在$GIT_DIR/modules/foo/一個(gè)工作目錄下有一個(gè)Git目錄path/to/bar/,那么超級(jí)gitlink項(xiàng)目通過表單的樹中的path/to/bar一個(gè)入口和其.gitmodules文件中的一個(gè)入口(請(qǐng)參閱gitmodules [5])來跟蹤子模塊submodule.foo.path = path/to/bar。

gitlink條目包含超級(jí)項(xiàng)目期望子模塊的工作目錄所處的提交的對(duì)象名稱。

所述部分submodule.foo.*.gitmodules的文件提供了額外的提示來GITS瓷層,諸如在哪里獲得經(jīng)由所述子模塊submodule.foo.url的設(shè)置。

子模塊可以用于至少兩種不同的使用情況:

  1. 使用另一個(gè)項(xiàng)目同時(shí)保持獨(dú)立的歷史 子模塊允許您在自己的工作樹中包含另一個(gè)項(xiàng)目的工作樹,同時(shí)保持兩個(gè)項(xiàng)目的歷史分離。另外,由于子模塊固定為任意版本,所以其他項(xiàng)目可以獨(dú)立開發(fā)而不會(huì)影響超級(jí)項(xiàng)目,只有在需要時(shí)才允許超級(jí)項(xiàng)目項(xiàng)目自行修復(fù)新版本。

  2. 將一個(gè)(邏輯上單一的)項(xiàng)目拆分成多個(gè)存儲(chǔ)庫(kù)并將它們重新綁定在一起。這可以用來克服 Gits 實(shí)現(xiàn)的當(dāng)前局限性,以實(shí)現(xiàn)更好的粒度訪問:

-  Size of the git repository: In its current form Git scales up poorly for large repositories containing content that is not compressed by delta computation between trees. However you can also use submodules to e.g. hold large binary assets and these repositories are then shallowly cloned such that you do not have a large history locally.
-  Transfer size: In its current form Git requires the whole working tree present. It does not allow partial trees to be transferred in fetch or clone.
-  Access control: By restricting user access to submodules, this can be used to implement read/write policies for different users.

子模塊的配置

子模塊操作可以使用以下機(jī)制進(jìn)行配置(從最高到最低優(yōu)先級(jí)):

  • 支持獲取子模塊規(guī)格的那些命令的命令行。大多數(shù)命令都有一個(gè)布爾標(biāo)志,--recurse-submodules是否遞歸到子模塊中。例子是ls-filescheckout。一些命令使用枚舉,比如fetchpush,您可以指定子模塊如何受到影響。

  • 子模塊內(nèi)部的配置。這包括$GIT_DIR/config在子模塊中,還包括樹中的設(shè)置(如a .gitattributes.gitignore指定子模塊內(nèi)命令行為的文件)。例如,.gitignore當(dāng)您git status --ignore-submodules=none在超級(jí)項(xiàng)目中運(yùn)行時(shí),將會(huì)觀察到子模塊文件的影響。這通過status在注意其.gitignore文件的子模塊中運(yùn)行來從子模塊的工作目錄收集信息。子模塊的$GIT_DIR/config文件git push --recurse-submodules=check在超級(jí)項(xiàng)目中運(yùn)行時(shí)會(huì)起作用,因?yàn)檫@將檢查子模塊是否有任何未發(fā)布到任何遠(yuǎn)程的更改。遙控器在$GIT_DIR/config文件中像往常一樣在子模塊中進(jìn)行配置。

  • $GIT_DIR/config超級(jí)項(xiàng)目中的配置文件。在這個(gè)地方的典型配置是控制一個(gè)子模塊是否通過active例如標(biāo)志遞歸到所有的子模塊中。如果子模塊尚未初始化,那么子模塊內(nèi)部的配置尚不存在,因此例如在此處配置從哪里獲取子模塊的配置。

  • .gitmodules超級(jí)項(xiàng)目中的文件。除了子模塊名稱和路徑之間所需的映射之外,項(xiàng)目通常使用此文件為上游的存儲(chǔ)庫(kù)集合建議缺省值。該文件主要用作超級(jí)項(xiàng)目中名稱和路徑之間的映射,以便可以找到子模塊的git目錄。如果子模塊從未初始化,則這是唯一可以找到子模塊配置的地方。它作為最后一個(gè)回退來指定從哪里獲取子模塊。

形式

子模塊可以采取以下形式:

  • 描述中描述的基本形式包含 Git 目錄,工作目錄,gitlink一個(gè).gitmodules條目和一個(gè)條目。

  • “舊式”子模塊:帶有嵌入式.git目錄的工作目錄,以及超級(jí)項(xiàng)目中的跟蹤gitlink.gitmodules條目。這通常在使用較舊版本的 Git 生成的存儲(chǔ)庫(kù)中找到??梢允謩?dòng)構(gòu)建這些舊的表單存儲(chǔ)庫(kù)。在取消初始化或刪除(見下文)時(shí),子模塊 Git 目錄會(huì)自動(dòng)移動(dòng)到$GIT_DIR/modules/<name>/超級(jí)項(xiàng)目。

  • 去初始化子模塊:A gitlink和一個(gè).gitmodules條目,但沒有子模塊工作目錄。子模塊的git目錄可能在那里,因?yàn)樵诔跏蓟痝it目錄后會(huì)一直存在。應(yīng)該是工作目錄的目錄是空的。子模塊可以通過運(yùn)行取消初始化git submodule deinit。除了清空工作目錄外,該命令只修改超級(jí)項(xiàng)目的$GIT_DIR/config文件,所以超級(jí)項(xiàng)目的歷史不受影響。這可以撤消使用git submodule init

  • 已刪除的子模塊:可以通過運(yùn)行刪除子模塊git rm <submodule path> && git commit。這可以撤消使用git revert。刪除操作將刪除超級(jí)項(xiàng)目的跟蹤數(shù)據(jù),這些數(shù)據(jù)既是gitlink條目又是.gitmodules文件中的部分。子模塊的工作目錄已從文件系統(tǒng)中刪除,但Git目錄保留在其中,以便可以檢出過去的提交而無需從其他存儲(chǔ)庫(kù)中提取。要完全刪除子模塊,請(qǐng)手動(dòng)刪除$GIT_DIR/modules/<name>/。

第三方庫(kù)的工作流程

# add a submodule
git submodule add <url> <path>
# occasionally update the submodule to a new version:git -C <path> checkout <new version>git add <path>git commit -m "update submodule to new version"
# See the list of submodules in a superproject
git submodule status
# See FORMS on removing submodules

人工拆分回購(gòu)的工作流程

# Enable recursion for relevant commands, such that
# regular commands recurse into submodules by defaultgit config --global submodule.recurse true
# Unlike the other commands below clone still needs
# its own recurse flag:git clone --recurse <URL> <directory>cd <directory>
# Get to know the code:git grep foo
git ls-files
# Get new codegit fetch
git pull --rebase
# change worktree
git checkout
git reset

實(shí)施細(xì)節(jié)

克隆或拉取包含子模塊的存儲(chǔ)庫(kù)時(shí),默認(rèn)情況下不會(huì)檢出子模塊; 您可以指示clone遞歸到子模塊。該initupdate的子命令git submodule將保持子模塊簽出,并在您的工作樹適當(dāng)?shù)男抻??;蛘?,您可以設(shè)置submodule.recursecheckout遞歸到子模塊。

Previous article: Next article: