gpt4 book ai didi

git ls-tree db/*.rb 不工作

转载 作者:行者123 更新时间:2023-12-02 02:34:10 28 4
gpt4 key购买 nike

我正在查看 man page for git ls-tree .它有一个路径选项。

我有一个名为 db 的目录,在该目录中我有一些 .rb 文件。

那为什么我的命令失败了

git ls-tree db/*.rb

最佳答案

首先是 actual man page is here .这是最新 Git 版本的页面。

其次,该官方手册页说:

Lists the contents of a given tree object, like what "/bin/ls -a" does in the current working directory.
Note that:

  • the behaviour is slightly different from that of "/bin/ls" in that the paths denote just a list of patterns to match, e.g. so specifying directory name (without -r) will behave differently, and order of the arguments does not matter.

  • the behaviour is similar to that of "/bin/ls" in that the paths is taken as relative to the current working directory.
    E.g. when you are in a directory sub that has a directory dir, you can run git ls-tree -r HEAD dir to list the contents of the tree (that is sub/dir in HEAD).
    You don't want to give a tree that is not at the root level (e.g. git ls-tree -r HEAD:sub dir) in this case, as that would result in asking for sub/sub/dir in the HEAD commit. However, the current working directory can be ignored by passing --full-tree option.

在你的情况下:

git ls-tree HEAD db/*.rb

可能会更好。

关于git ls-tree db/*.rb 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2536171/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com