如何仅列出将要提交的文件? [英] How do I list just the files that would be committed?
问题描述
当我键入以下内容时,是否有任何方法可以获取将提交的文件列表?
Is there any way to get a list of files that will be committed when I type the following?
git commit -m "my changes"
git状态列表太多。我可以删除所有单词,但我不想。而且我也不想被告知未跟踪的文件。
git status lists too much. I could strip out all the words, but I'd rather not. And I don't want to be told about untracked files.
我已经尝试过
git ls-files -md
但这不显示具有以下内容的文件
but that doesn't show files that have been recently added, but not yet committed.
我正在寻找与
svn status -q
例如
$ svn status -q
A file.py
M目录/数据库.py
M start.py
For example
$ svn status -q
A file.py
M dir/database.py
M start.py
推荐答案
这就是我想要的。感谢notnoop为我所需要的领导。我想回传我的解决方案,以防其他人得到帮助。
This is what I was looking for. Thanks to notnoop for the lead I needed. I wanted to post back my solution in case it helps others.
git diff HEAD --name-only
自从我打算这样做
git commit -s -F mesage.txt
,并在第一行找到文件。
with the files found in the first line.
我的意图是创建一个完全忽略索引的小系统,即我永远不需要执行git add。 (据我了解,索引在创建补丁程序时很有用,这绝对不是我工作流程中的常态。)
My intent is to create a little system that totally ignores the index i.e. that I never need to do git add. (From what I understand, the index is useful when creating patches, which isn't by no means the norm in my workflow.)
这篇关于如何仅列出将要提交的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!