亚洲国产日韩欧美一区二区三区,精品亚洲国产成人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

命名

git-gc  - 清理不必要的文件并優(yōu)化本地存儲庫

概要

git gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force]

描述

在當前存儲庫中運行許多內(nèi)務(wù)處理任務(wù),例如壓縮文件修訂(以減少磁盤空間并提高性能)并移除可能由之前git add調(diào)用創(chuàng)建的不可達對象。

鼓勵用戶在每個存儲庫中定期運行此任務(wù),以保持良好的磁盤空間利用率和良好的操作性能。

一些git命令可能會自動運行git gc; --auto詳細信息請參閱下面的標志。如果您知道自己在做什么,并且所有您想要的都是永久禁用此行為而無需進一步考慮,請執(zhí)行以下操作:

$ git config --global gc.auto 0

選項

--aggressive

通常git gc運行速度很快,同時提供良好的磁盤空間利用率和性能 此選項將導致git gc更積極地優(yōu)化存儲庫,但花費更多時間。這種優(yōu)化的效果是持久的,所以這個選項只需要偶爾使用; 每隔幾百個變更集左右。

--auto

使用此選項,git gc檢查是否需要進行任何清潔工作; 如果沒有,它會退出而不執(zhí)行任何工作。一些git命令git gc --auto在執(zhí)行可能會產(chǎn)生許多松散對象的操作之后運行。

如果存儲庫中的松散對象太多或包裝太多,則需要進行內(nèi)務(wù)處理。如果松散對象的數(shù)量超過了gc.auto配置變量的值,則所有松散對象都將使用組合到一個包中git repack -d -l。將值設(shè)置gc.auto為0將禁用自動填充松散物體。

如果包裝數(shù)量超過了價值gc.autoPackLimit,那么現(xiàn)有包裝(標有.keep文件的包裝除外)將通過使用-A選項合并到一個包裝中git repack。設(shè)置gc.autoPackLimit為0將禁用自動合并包裝。

--prune=<date>

修剪比日期更舊的松散對象(默認為2周前,可由配置變量覆蓋gc.pruneExpire)。--prune =不管年齡大小,都修剪松散的物體,并且如果另一個進程同時寫入存儲庫,則會增加腐敗風險; 請參閱下面的“注意事項”。--prune默認打開。

--no-prune

不要修剪任何松動的物體。

--quiet

取消所有進度報告。

--force

git gc即使可能有另一個git gc實例在此存儲庫上運行,也強制運行。

組態(tài)

可選配置變量gc.reflogExpire可以設(shè)置為指示每個分支的reflog中的歷史條目應(yīng)該在此存儲庫中保持可用的時間。該設(shè)置表示為一段時間,例如90 days3 months。它默認為90 days。

可選配置變量gc.reflogExpireUnreachable可設(shè)置為指示不屬于當前分支的歷史請求日志條目在此存儲庫中保持可用的時間。這些類型的條目通常是由于使用git commit --amendgit rebase而創(chuàng)建的,并且是在修改或重新發(fā)生之前的提交。由于這些更改不是當前項目的一部分,因此大多數(shù)用戶都希望盡快過期。該選項默認為30 days。

上述兩個配置變量可以賦予一個模式。例如,這會將非默認到期值設(shè)置為遠程跟蹤分支:

[gc "refs/remotes/*"]
        reflogExpire = never
        reflogExpireUnreachable = 3 days

可選的配置變量gc.rerereResolved指示您先前解決的沖突合并記錄的保存期限。這默認為60天。

可選的配置變量gc.rerereUnresolved表示保留了多久沒有解決的沖突合并記錄。這默認為15天。

可選的配置變量gc.packRefs確定是否git gc運行git pack-refs??梢詫⑵湓O(shè)置為“notbare”,以便在所有非裸回購庫中啟用它,或者可以將其設(shè)置為布爾值。這默認為true。

可選配置變量gc.aggressiveWindow控制在指定--aggressive選項時優(yōu)化存儲庫中對象的增量壓縮所花費的時間。值越大,優(yōu)化增量壓縮花費的時間就越多。有關(guān)更多詳細信息,請參閱git-repack [1]中--window'選項的文檔。這默認為250。

同樣,可選的配置變量gc.aggressiveDepth控制git-repack [1]中的--depth選項。默認值為50。

可選的配置變量gc.pruneExpire控制未修剪的松散對象在修剪之前必須經(jīng)過多久。默認值是“2周前”。

注意

git gc盡量不要刪除在存儲庫中任何位置引用的對象。特別是,它不僅會保存當前一組分支和標記所引用的對象,還會保留由索引引用的對象,遠程跟蹤分支,git filter-branchrefs / original /中保存的引用或reflogs(可引用分支中的提交后來修改或倒帶)。如果您希望某些對象被刪除而不是,請檢查所有這些位置,并決定在您的情況下刪除這些引用是否有意義。

另一方面,當git gc與另一個進程同時運行時,可能會刪除另一個進程正在使用但尚未創(chuàng)建引用的對象。這可能會導致其他進程失敗或者可能會損壞存儲庫,如果其他進程稍后添加對已刪除對象的引用。Git有兩個功能可以顯著緩解這個問題:

  1. --prune保留修改時間比日期更新的任何對象以及可從其訪問的所有對象。

  1. 將對象添加到數(shù)據(jù)庫的大多數(shù)操作都會更新對象的修改時間(如果該對象已存在,以便應(yīng)用#1)。

然而,這些功能并不能提供完整的解決方案,因此,同時運行命令的用戶必須忍受一些腐敗風險(實踐中似乎很低),除非他們關(guān)閉自動垃圾收集git config gc.auto 0。

Hooks

git gc --auto命令將運行該pre-auto-gc鉤子。有關(guān)更多信息,請參閱githooks [5]。

Previous article: Next article: