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

目錄 搜尋
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
文字

命名

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

概要

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

描述

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

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

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

$ git config --global gc.auto 0

選項(xiàng)

--aggressive

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

--auto

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

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

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

--prune=<date>

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

--no-prune

不要修剪任何松動(dòng)的物體。

--quiet

取消所有進(jìn)度報(bào)告。

--force

git gc即使可能有另一個(gè)git gc實(shí)例在此存儲庫上運(yùn)行,也強(qiáng)制運(yùn)行。

組態(tài)

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

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

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

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

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

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

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

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

同樣,可選的配置變量gc.aggressiveDepth控制git-repack [1]中的--depth選項(xiàng)。默認(rèn)值為50。

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

注意

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

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

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

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

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

Hooks

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

上一篇: 下一篇: