git状态->显示将在子目录中添加(暂存)的文件 [英] git status -> Show files that will be added (staged) in subdirectories

查看:57
本文介绍了git状态->显示将在子目录中添加(暂存)的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在一个文件夹中启动git存储库,并且其中有几个子目录.

Say I start a git repository in a folder, and I have several subdirectories in it.

我有几种遍历模式.gitignore以排除子目录中的文件.但是,当我在暂存任何东西之前执行git status 时,git status仅显示要添加的子文件夹的名称,而没有具体说明如果要添加(暂存)每个子目录中的哪些文件我做git add ..

I have several globbing patterns .gitignore to exclude files in the subdirectories. However, when I do git status before I stage anything, git status only shows the names of the subfolders that will be added, without being specific about which files in each subdirectory will be added (staged) if I do git add ..

但是有趣的是,git status是明确的,关于在我使用git add .暂存文件之后将提交的文件.

Interestingly though, git status is explicit about the files that will be committed after I stage files with git add ..

是否有必要要求git status明确说明要进行暂存的文件的文件?

Is there anyway to ask git status to be explicit about files for the files that would be staged?

推荐答案

尝试:

git status -u

或长格式:

git status --untracked-files

将显示未跟踪目录中的单个文件.

which will show individual files in untracked directories.

这是 git-status手册页-u选项的详细说明>:

Here's the detailed description of -u option from git-status man page:

-u[<mode>]
--untracked-files[=<mode>]

显示未跟踪的文件.

mode参数是可选的(默认为all),用于指定未跟踪文件的处理.不使用-u时,默认值为normal,即显示未跟踪的文件和目录.

The mode parameter is optional (defaults to all), and is used to specify the handling of untracked files; when -u is not used, the default is normal, i.e. show untracked files and directories.

可能的选项是:

  • no-不显示未跟踪的文件
  • normal-显示未跟踪的文件和目录
  • all-还显示未跟踪目录中的单个文件.
  • no - Show no untracked files
  • normal - Shows untracked files and directories
  • all - Also shows individual files in untracked directories.

可以使用 git-config( 1).

这篇关于git状态-&gt;显示将在子目录中添加(暂存)的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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