【发布时间】:2020-09-06 03:28:35
【问题描述】:
例如:
$ git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: test.txt
$ git ls-files
test.txt
test.txt
test.txt
有没有办法让它也只列出一次这种类型的文件?我只需要文件名。
【问题讨论】:
-
考虑使用
git status --porcelain或git status --porcelain=v2以获得机器可读的输出。或者,使用git ls-files --stage并解析完整的输出。 -
好建议,但
git status不支持我需要的所有选项。特别是,无法在输出中包含未修改的文件。
标签: git git-ls-files