目录 搜索
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
文字

名称(Name)

git-prune  - 从对象数据库中删除所有不可访问的对象

概要

git prune [-n] [-v] [--expire <expire>] [--] [<head>…]

描述

注意

在大多数情况下,用户应该运行 git gc,它调用 git prune。请参阅下面的“注意”部分。

这将git fsck --unreachable使用所有可用的引用refs/,可选地包含在命令行中指定的其他对象集合,并修剪来自对象数据库的任何这些头对象不可访问的所有解压缩对象。另外,它通过运行修剪也在包中找到的未打包对象git prune-packed。它还从 .git / shallow 中删除任何 ref 无法访问的条目。

请注意,无法访问,打包的对象将保留。如果不需要,请参阅 git-repack [1]。

选项

-n   --dry-run

不要删除任何东西; 只是报告它会删除什么。

-v   --verbose

报告所有移除的对象。

--

不要将更多的参数解释为选项。

--expire <time>

只会过期比<time>更旧的松散对象。

<head>…

除了我们任何引用可访问的对象之外,还可以从列出的<head>中保持对象可访问。

示例

要修剪未由您的存储库使用的对象或从您的存储库借用以下内容的对象.git/objects/info/alternates

$ git prune $(cd ../another && git rev-parse --all)

注意

在大多数情况下,用户不需要git prune直接调用,而是应该调用git gc,它可以处理修剪以及许多其他内务处理任务。

有关修剪考虑哪些对象的描述,请参阅git fsck's --unreachable 选项。

也可以看看

git-fsck[1], git-gc[1], git-reflog[1]

上一篇: 下一篇: