git ls-tree输出的工作目录? [英] git ls-tree output of working directory?
问题描述
我正在寻找一种方法来以与 ls-tree
相同的方式输出,但是我的工作目录。每当我运行 git ls-tree。
时,它表示致命:不是有效的对象名称。
git ls-tree
只适用于git refs,例如 ls-tree HEAD
。
尝试 git ls-files
。您可能需要 -s
和/或 -m
标志。
正如你指出的那样, git ls-files -s
会列出索引中的文件(即文件在理论上,你可能会弄乱索引,运行 git ls-files -s
,然后尝试恢复它,例如
git commit
git add。
git ls-files -s
git reset。
git reset --soft HEAD ^
看起来正确,并且在一个简单的测试中工作,但可以吃掉所有的文件。
I am looking for a way to have output in the same manner as ls-tree
, but of my working directory. Whenever I run git ls-tree .
it says fatal: Not a valid object name .
git ls-tree
only works with git refs, e.g. ls-tree HEAD
.
Try git ls-files
. You probably want the -s
and/or -m
flags.
As you point out, git ls-files -s
will list the files in the index (i.e. files that have been staged).
In theory, you could mess with the index, run git ls-files -s
, then try restore it, e.g.
git commit
git add .
git ls-files -s
git reset .
git reset --soft HEAD^
Seems right, and worked in a simple test, but could eat all your files.
这篇关于git ls-tree输出的工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!