git:显示所有已修改的文件-已暂存和未暂存 [英] git: show all modified files - staged and not staged

查看:492
本文介绍了git:显示所有已修改的文件-已暂存和未暂存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个命令,该命令可以给我所有修改过的文件-其中包括暂存(即新添加的文件)和未暂存的更改-在纯列表中,我可以在脚本中使用.虽然这个问题听起来很熟悉,但我只能找到与我想做的事情接近的命令:

I need a command which gives me all modified files - this includes staged (i.e. newly added files) and non-staged changes - in a plain list which I can use in a script. While this question might sound familiar I only find commands that come close to what I want to do:

git ls-files -m

..列出(非分阶段的)修改,但忽略分阶段的和新的 添加的文件

.. lists (non staged) modifications but ignores staged and newly added files

git diff --name-only

..还将仅列出未分级的修改

git diff --name-only --cached

..仅列出已分段的修改,但忽略未分段的文件 修改

.. lists only staged modifications but omits files with non-staged modifications

git status --porcelain --untracked-files=no

..输出所有我想查看的文件,但添加状态

.. outputs all files I want to see but adds the status

我当然可以使用git statuscut作为第一个条目,但是由于我想将此命令集成到CMake脚本中,该脚本也将在Windows上使用.所以一个命令就可以了.

I could play with git status of course and cut the first entry but since I want to integrate this command in a CMake script which will be used on windows, too. So one single command would be fine..

推荐答案

git diff --name-only HEAD

看起来像我要找的东西-但我不确定.如果有人想出办法,我会回答他的:)

looks like what I'm looking for - but I'm not sure yet. If someone comes up with some elaboration I'll take his/her answer :)

这篇关于git:显示所有已修改的文件-已暂存和未暂存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆