如何在 git 中列出版本控制的文件?

发布于 2024-08-05 06:17:52 字数 149 浏览 2 评论 0原文

我想列出 git 存储库根目录中的版本控制文件。要在 bazaar 中执行相同的操作,请运行:

bzr ls --versioned --non-recursive

How do I do this in git?

I would like to list the versioned files in the root directory of a git repository. To do the same thing in bazaar, you run:

bzr ls --versioned --non-recursive

How do I do this in git?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆流 2024-08-12 06:17:52

如果您准确描述要显示的列表,将会更有帮助。从 bzr 文档猜测,我想你想要这样的东西。

git ls-tree --name-only HEAD

这列出了当前目录中当前位于 HEAD 版本中的文件的名称,该名称应该接近您所要求的内容。

It would be more helpful if you described exactly what listing you want to show. Guessing from the bzr document, I imagine that you want something like this.

git ls-tree --name-only HEAD

This lists the names of files in the current directory which are currently in the HEAD revision, which should be close to what you are asking for.

东北女汉子 2024-08-12 06:17:52

我不知道“bzr ls --versioned --non-recursive”的作用,但我怀疑它是

  • git ls-files" (可能还需要加上 --cached 和 --排除标准选项),它列出了指定类型的文件(默认情况下是索引中的文件),并且是递归的(据我所知,目前没有办法关闭递归)。

I do not know what "bzr ls --versioned --non-recursive" does, but I suspect that it is either

or

  • "git ls-files" (perhaps additionally with --cached and --exclude-standard options), which lists specified kinds of files (by default it is files that are in index), and is recursive (and currently there is no way to turn off being recursive, as far as I know).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文