“git status”中的“T”是什么意思?(它不在手册页中)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8691199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:37:12  来源:igfitidea点击:

What does "T" mean in "git status"? (it isn't in the man page)

git

提问by sdlins

When I type git statusI see:

当我输入时,git status我看到:

T /path/to/file...
M /path/to/otherfile...

What exactly does the Tgit statusmean?

究竟是什么Tgit status意思?

I tried man git-status(I think it shouldbe there, but isn't).

我试过man git-status(我认为它应该在那里,但不是)。

回答by Tom van der Woerdt

It means that the type of a file changed. For example, a symbolic link that became a regular file.

这意味着文件的类型已更改。例如,成为常规文件的符号链接。

As far as I know, this only applies to symlinks, submodules and regular files

据我所知,这只适用于符号链接、子模块和常规文件

Edit
A source was requested for this information. While this is simply information that's in my head, I was able to find a few references to it on the internet. The most prominent one was a git changelogmentioning "T" as a type change and "D" as a deletion.

编辑
此信息的来源已被请求。虽然这只是我脑海中的信息,但我还是在互联网上找到了一些参考资料。最突出的是一个 git changelog提到“T”作为类型更改和“D”作为删除。

Edit 2(updating this because it's my highest rating answer so far)
As pointed out by @PhilipOakley, man git-diff-filesactually does show this information.

编辑 2 (更新此内容,因为这是我迄今为止评分最高的答案)
正如@PhilipOakley 所指出的,man git-diff-files实际上确实显示了此信息。

Possible status letters are:

  • A: addition of a file
  • C: copy of a file into a new one
  • D: deletion of a file
  • M: modification of the contents or mode of a file
  • R: renaming of a file
  • T: change in the type of the file
  • U: file is unmerged (you must complete the merge before it can be committed)
  • X: "unknown" change type (most probably a bug, please report it)

可能的状态字母是:

  • A:添加文件
  • C:将文件复制到新文件中
  • D:删除文件
  • M:修改文件的内容或模式
  • R:重命名文件
  • T:改变文件类型
  • U:文件未合并(必须完成合并后才能提交)
  • X:“未知”更改类型(很可能是错误,请报告)

As pointed out by @Mat, it's also in diff.h, line 289:

正如@Mat 所指出的,它也在diff.h第 289 行:

#define DIFF_STATUS_TYPE_CHANGED    'T'

And in wt-status.c, line 282:

wt-status.c第 282 行:

case DIFF_STATUS_TYPE_CHANGED:
    status_printf_more(s, c, _("typechange: %s"), one);
    break;

回答by Philip Oakley

The code letters are listed in git-diff-filesand git-diff-indexunder the --diff-filteroption. They include these less common ones not listed under git-status.

该代码的信件中列出了git-diff-filesgit-diff-index--diff-filter选项。它们包括未在 下列出的这些不太常见的git-status

have their type (i.e. regular file, symlink, submodule, …) changed (T),

更改它们的类型(即常规文件、符号链接、子模块等)(T),

From git help diff-filesmsysgit version 1.7.8-preview20111206

git help diff-filesmsysgit 版本 1.7.8-preview20111206