目录 搜索
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-ls-tree  - 列出树对象的内容

概要

git ls-tree [-d] [-r] [-t] [-l] [-z]            [--name-only] [--name-status] [--full-name] [--full-tree] [--abbrev[=<n>]]            <tree-ish> [<path>…]

描述

列出给定树对象的内容,例如“/ bin / ls -a”在当前工作目录中所做的内容。注意:

  • 该行为与“/ bin / ls”的行为稍有不同,因为它<path>仅表示要匹配的模式列表,例如,指定目录名称(不含-r)将具有不同的行为,并且参数的顺序无关紧要。

  • 该行为与“/ bin / ls”的行为相似,<path>因为相对于当前工作目录而言。例如,当你在一个sub具有目录的目录中时dir,你可以运行git ls-tree -r HEAD dir以列出树的内容(即sub/dirHEAD)。你不想给一棵树,是不是在根级别(例如,git ls-tree -r HEAD:sub dir在这种情况下),因为这将导致要求sub/sub/dirHEAD承诺。但是,通过传递--full-tree 选项可以忽略当前工作目录。

选项

<tree-ish>

Id of a tree-ish.

-d

仅显示已命名的树条目本身,而不是其子节点。

-r

递归到子树中。

-t

甚至在进行递归时也显示树条目。如果-r未通过,则无效。-d意味着-t

-l   --long

显示 blob(文件)条目的对象大小。

-z

\ 0 行输出终止,不要引用文件名。有关更多信息,请参阅下面的 OUTPUT FORMAT。

--name-only   --name-status

仅列出文件名(而不是“长”输出),每行一个。

--abbrev=<n>

不显示完整的40字节十六进制对象行,只显示部分前缀。非默认位数可以用--abbrev = <n> 来指定。

--full-name

显示相对于当前工作目录的路径名称,而不是显示完整的路径名称。

--full-tree

不要将列表限制到当前工作目录。意味着 --full-name。

<path>…

当给出路径时,显示它们(请注意,这不是真正的原始路径名,而是一组匹配的模式列表)。否则,隐式使用树的根级作为唯一的路径参数。

输出格式

<mode> SP <type> SP <object> TAB <file>

这种输出格式是什么兼容--index-info --stdingit update-index期望。

当使用该-l选项时,格式更改为

<mode> SP <type> SP <object> SP <object size> TAB <file>

由<object>标识的对象大小以字节为单位,右对齐,最小宽度为7个字符。对象大小仅适用于 blob(文件)条目; 对于其他条目,-字符用于代替大小。

如果没有这个-z选项,带有“不寻常”字符的路径名将按照配置变量的说明引用core.quotePath(请参阅 git-config [1])。使用-z文件名是逐字输出的,并且该行由 NUL 字节终止。

上一篇: 下一篇: