uTools-Manuals/docs/git/git status.html
2019-04-08 23:22:26 +08:00

18 lines
21 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="c-markdown doc-markdown"><div class="doc-postil"><div class="c-markdown"><h2>命名</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>git-status  - 显示工作树的状态</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>概要</h2></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">git status [&lt;options&gt;…] [--] [&lt;pathspec&gt;…]</pre></div></div><div class="doc-postil"><div class="c-markdown"><h2>描述</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>显示索引文件和当前HEAD提交之间存在差异的路径工作树和索引文件之间存在差异的路径以及工作树中未由Git跟踪的路径并且不会被gitignore [5]忽略) )。首先是你<code>would</code>通过跑步提交的内容<code>git commit</code>; 第二和第三是<code>could</code>在运行<code>git add</code>之前运行的内容<code>git commit</code></p></div></div><div class="doc-postil"><div class="c-markdown"><h2>选项</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>-s   --short</p></div></div><div class="doc-postil"><div class="c-markdown"><p>以短格式输出输出。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>-b   --branch</p></div></div><div class="doc-postil"><div class="c-markdown"><p>甚至以短格式显示分支和跟踪信息。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--show-stash</p></div></div><div class="doc-postil"><div class="c-markdown"><p>显示当前隐藏的条目数量。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--porcelain=&lt;version&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>为脚本提供易于解析格式的输出。这与短输出类似但在Git版本中保持稳定并且不管用户配置如何。详情请参阅下文。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>版本参数用于指定格式版本。这是可选的,默认为原始版本<code>v1</code>格式。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>--long</p></div></div><div class="doc-postil"><div class="c-markdown"><p>以长格式输出输出。这是默认设置。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>-v   --verbose</p></div></div><div class="doc-postil"><div class="c-markdown"><p>除了已更改的文件名称之外,还会显示将要提交的文本更改(即与输出一样<code>git diff --cached</code>)。如果<code>-v</code>指定了两次,那么还会显示尚未上演的工作树中的更改(即与输出一样<code>git diff</code>)。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>-u&lt;mode&gt;   --untracked-files=&lt;mode&gt;</p></div></div><div class="doc-postil"><div class="c-markdown"><p>显示未跟踪的文件。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>The mode parameter is used to specify the handling of untracked files. It is optional: it defaults to <code>all</code>, and if specified, it must be stuck to the option (e.g. <code>-uno</code>, but not <code>-u no</code>).</p></div></div><div class="doc-postil"><div class="c-markdown"><p>可能的选项是:</p></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>no</code>  - 不显示未跟踪的文件。</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>normal</code>  - 显示未跟踪的文件和目录。</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>all</code>- 还显示未跟踪目录中的单个文件。当<code>-u</code>不使用选项时,显示未跟踪的文件和目录(即与指定相同<code>normal</code>),以帮助您避免忘记添加新创建的文件。由于需要额外的工作才能在文件系统中查找未跟踪的文件,因此在大型工作树中,此模式可能需要一些时间。考虑启用未跟踪缓存和分离指标如果支持的话(见<code>git update-index --untracked-cache</code><code>git update-index --split-index</code>),否则,你可以使用<code>no</code><code>git status</code>返回更快而不会显示未跟踪的文件。可以使用git-config [1]中记录的status.showUntrackedFiles配置变量来更改默认值。--ignore-submodules = &lt;when&gt;查找更改时忽略对子模块的更改。&lt;when&gt;可以是“none”“untracked”“dirty”或“all”这是默认设置。如果子模块包含未跟踪或已修改的文件或者HEAD与超级项目中记录的提交不同并且可用于覆盖<code>ignore</code>选项在git-config [1]或gitmodules [5]中。当使用“未跟踪”时如果子模块仅包含未跟踪内容但仍然针对修改内容进行扫描则子模块不会被视为脏。使用“dirty”忽略对子模块工作树的所有更改只显示存储在超级项目中的提交更改这是1.7.0之前的行为。使用“all”隐藏对子模块的所有更改并在<code>status.submoduleSummary</code>设置了配置选项时禁止输出子模块摘要)。 - 也显示忽略的文件。-z使用NUL而不是LF终止条目。<code>--porcelain=v1</code>如果没有给出其他格式,这意味着输出格式。--column = &lt;选项&gt; --no-column在列中显示未跟踪的文件。有关选项语法请参阅配置变量column.status。<code>--column--no-column</code>没有选项相当于<code>always</code><code>never</code>分别。&lt;pathspec&gt; ...请参阅<code>pathspec</code>gitglossary [7]中的条目。输出此命令的输出旨在用作提交模板注释。默认的长格式设计为人类可读详细和描述性的。它的内容和格式随时可能发生变化。输出中提到的路径与其他许多Git命令不同它是相对于当前目录而言的如果您在子目录中工作这是为了帮助剪切和粘贴。请参阅下面的status.relativePaths配置选项。小格式在短格式中每个路径的状态显示为XY PATH1  - &gt; PATH2其中<code>PATH1</code>是路径<code>HEAD</code>,而“ <code>-&gt; PATH2</code>”部分仅在显示时显示<code>PATH1</code>对应于索引/工作树中的不同路径(即文件被重命名)。这<code>XY</code>是一个双字母状态码。字段(包括<code>-&gt;</code>由一个空格相互分隔。如果文件名包含空格或其他非打印字符则该字段将以C字符串文字的方式引用由ASCII双引号34字符包围并且包含内部特殊字符反斜线转义。对于具有合并冲突的路径<code>X</code>以及<code>Y</code>显示合并每一侧的修改状态。对于没有合并冲突的路径,<code>X</code>显示索引<code>Y</code>的状态,并显示工作树的状态。对于未跟踪的路径,<code>XY</code><code>??</code>。其他状态代码可以解释如下:</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p>''=未修改</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>M</code> =修改</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>A</code> =已添加</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>D</code> =已删除</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>R</code> =重命名</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>C</code> =复制</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p><code>U</code> =已更新但尚未装入</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><p>被忽略的文件未列出,除非<code>--ignored</code>选项生效,在这种情况下<code>XY</code><code>!!</code></p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">X          Y     Meaning-------------------------------------------------          [MD]   not updated
M        [ MD]   updated in index
A        [ MD]   added to index
D         [ M]   deleted from index
R        [ MD]   renamed in index
C        [ MD]   copied in index[MARC]           index and work tree matches[ MARC]     M    work tree changed since index[ MARC]     D    deleted in work tree-------------------------------------------------D           D    unmerged, both deleted
A           U    unmerged, added by us
U           D    unmerged, deleted by them
U           A    unmerged, added by them
D           U    unmerged, deleted by us
A           A    unmerged, both added
U           U    unmerged, both modified-------------------------------------------------?           ?    untracked!           !    ignored-------------------------------------------------</pre></div></div><div class="doc-postil"><div class="c-markdown"><p>子模块具有更多的状态相反报告M子模块具有与索引m中记录的HEAD不同的子模块具有修改的内容子模块具有未跟踪文件因为子模块中的修改内容或未跟踪文件无法通过<code>git add</code>超级项目添加以准备提交。</p></div></div><div class="doc-postil"><div class="c-markdown"><p><code>m</code><code>?</code>递归应用。例如,如果子模块中的嵌套子模块包含未跟踪文件,则也会报告此情况<code>?</code></p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果使用-b则短格式状态前面有一行</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">## branchname tracking info</pre></div></div><div class="doc-postil"><div class="c-markdown"><h3>Porcelain Format Version 1</h3></div></div><div class="doc-postil"><div class="c-markdown"><p>版本1的瓷质格式与短格式类似但保证不会以Git版本之间不兼容的方式或基于用户配置进行更改。这使它成为脚本解析的理想选择。上面短格式的描述也描述了瓷器格式但有一些例外</p></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p>用户的color.status配置不受尊重; 颜色将始终关闭。</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><ul class="ul-level-0 list-paddingleft-2" style="margin: 10px 0px 10px 20px;"><li><p>用户的status.relativePaths配置不受尊重; 显示的路径将始终与存储库根目录相关。</p></li></ul></div></div><div class="doc-postil"><div class="c-markdown"><p>还有一种推荐用于机器解析的备用-z格式。在这种格式下状态字段是相同的但其他一些事情会改变。首先<code>-&gt;</code>从重命名条目中忽略该字段,并且字段顺序颠倒(例如<code>from -&gt; to</code>变成<code>to from</code>。其次NULASCII 0跟在每个文件名后面将空格替换为字段分隔符和终止换行符但空格仍将状态字段与第一个文件名隔开。第三包含特殊字符的文件名不是专门格式化的; 不执行引用或反斜杠转义。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>任何子模块更改都将报告为已修改<code>M</code>而不是<code>m</code>或单个报告<code>?</code></p></div></div><div class="doc-postil"><div class="c-markdown"><h3>Porcelain Format Version 2</h3></div></div><div class="doc-postil"><div class="c-markdown"><p>版本2格式添加了有关工作树状态和更改项目的更详细信息。第2版还定义了一套易于解析可选标题的可扩展集合。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>标题行以“#”开头,并在响应特定命令行参数时添加。解析器应该忽略它们不认识的标题。</p></div></div><div class="doc-postil"><div class="c-markdown"><h3>Branch Headers</h3></div></div><div class="doc-postil"><div class="c-markdown"><p>如果<code>--branch</code>给出,则会打印一系列标题行,其中包含有关当前分支的信息。</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">Line                                     Notes------------------------------------------------------------# branch.oid &lt;commit&gt; | (initial)        Current commit.# branch.head &lt;branch&gt; | (detached)      Current branch.# branch.upstream &lt;upstream_branch&gt;      If upstream is set.# branch.ab +&lt;ahead&gt; -&lt;behind&gt;           If upstream is set and
             the commit is present.------------------------------------------------------------</pre></div></div><div class="doc-postil"><div class="c-markdown"><h3>Changed Tracked Entries</h3></div></div><div class="doc-postil"><div class="c-markdown"><p>在标题之后,会打印一系列行以跟踪条目。取决于改变的类型,可以使用三种不同的线格式之一来描述条目。被跟踪的条目以未定义的顺序打印; 解析器应该允许以任何顺序混合3种线型。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>普通更改的条目具有以下格式:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">1 &lt;XY&gt; &lt;sub&gt; &lt;mH&gt; &lt;mI&gt; &lt;mW&gt; &lt;hH&gt; &lt;hI&gt; &lt;path&gt;</pre></div></div><div class="doc-postil"><div class="c-markdown"><p>Renamed or copied entries have the following format:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">2 &lt;XY&gt; &lt;sub&gt; &lt;mH&gt; &lt;mI&gt; &lt;mW&gt; &lt;hH&gt; &lt;hI&gt; &lt;X&gt;&lt;score&gt; &lt;path&gt;&lt;sep&gt;&lt;origPath&gt;</pre></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">  Field       Meaning  --------------------------------------------------------  &lt;XY&gt;        A 2 character field containing the staged and
unstaged XY values described in the short format,with unchanged indicated by a "." rather than
a space.  &lt;sub&gt;       A 4 character field describing the submodule state."N..." when the entry is not a submodule."S&lt;c&gt;&lt;m&gt;&lt;u&gt;" when the entry is a submodule.&lt;c&gt; is "C" if the commit changed; otherwise ".".&lt;m&gt; is "M" if it has tracked changes; otherwise ".".&lt;u&gt; is "U" if there are untracked changes; otherwise ".".  &lt;mH&gt;        The octal file mode in HEAD.  &lt;mI&gt;        The octal file mode in the index.  &lt;mW&gt;        The octal file mode in the worktree.  &lt;hH&gt;        The object name in HEAD.  &lt;hI&gt;        The object name in the index.  &lt;X&gt;&lt;score&gt;  The rename or copy score (denoting the percentageof similarity between the source and target of the
move or copy). For example "R100" or "C75".  &lt;path&gt;      The pathname.  In a renamed/copied entry, thisis the path in the index and in the working tree.  &lt;sep&gt;       When the `-z` option is used, the 2 pathnames are separatedwith a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)byte separates them.  &lt;origPath&gt;  The pathname in the commit at HEAD.  This is only
present in a renamed/copied entry, and tells
where the renamed/copied contents came from.  --------------------------------------------------------</pre></div></div><div class="doc-postil"><div class="c-markdown"><p>未合并的条目具有以下格式; 第一个字符是“u”以区别于普通的已更改的条目。</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">u &lt;xy&gt; &lt;sub&gt; &lt;m1&gt; &lt;m2&gt; &lt;m3&gt; &lt;mW&gt; &lt;h1&gt; &lt;h2&gt; &lt;h3&gt; &lt;path&gt;</pre></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">  Field       Meaning  --------------------------------------------------------  &lt;XY&gt;        A 2 character field describing the conflict typeas described in the short format.  &lt;sub&gt;       A 4 character field describing the submodule stateas described above.  &lt;m1&gt;        The octal file mode in stage 1.  &lt;m2&gt;        The octal file mode in stage 2.  &lt;m3&gt;        The octal file mode in stage 3.  &lt;mW&gt;        The octal file mode in the worktree.  &lt;h1&gt;        The object name in stage 1.  &lt;h2&gt;        The object name in stage 2.  &lt;h3&gt;        The object name in stage 3.  &lt;path&gt;      The pathname.  --------------------------------------------------------</pre></div></div><div class="doc-postil"><div class="c-markdown"><h3>Other Items</h3></div></div><div class="doc-postil"><div class="c-markdown"><p>在跟踪的条目(如果请求)之后,会打印一系列行,以便在工作树中找到未跟踪的项目,然后忽略它们。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>未跟踪的项目具有以下格式:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">? &lt;path&gt;</pre></div></div><div class="doc-postil"><div class="c-markdown"><p>忽略的项目具有以下格式:</p></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript">! &lt;path&gt;</pre></div></div><div class="doc-postil"><div class="c-markdown"><h3>Pathname Format Notes and -z</h3></div></div><div class="doc-postil"><div class="c-markdown"><p><code>-z</code>给出该选项时路径名将按原样打印并且不带任何引用并且行以NULASCII 0x00字节结尾。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果没有这个<code>-z</code>选项,带有“不寻常”字符的路径名将按照配置变量的说明引用<code>core.quotePath</code>请参阅git-config [1])。</p></div></div><div class="doc-postil"><div class="c-markdown"><h2>Configuration</h2></div></div><div class="doc-postil"><div class="c-markdown"><p>该命令荣誉<code>color.status</code>(或<code>status.color</code>- 他们意味着相同的事情,后者保持向后兼容性)和<code>color.status.&lt;slot&gt;</code>配置变量来着色其输出。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果config变量<code>status.relativePaths</code>设置为false则显示的所有路径都是相对于存储库根目录而不是当前目录。</p></div></div><div class="doc-postil"><div class="c-markdown"><p>如果<code>status.submoduleSummary</code>设置为非零数字或true与-1或无限制数字相同则将为长格式启用子模块摘要并显示修改子模块的提交摘要请参阅--summary-limit选项git-submodule [1])。请注意,状态命令的摘要输出将在所有子模块<code>diff.ignoreSubmodules</code>被设置为<code>all</code>或仅限其中的子模块时被抑制<code>submodule.&lt;name&gt;.ignore=all</code>。要查看忽略子模块的摘要,可以使用--ignore-submodules = dirty命令行选项或<code>git submodule summary</code>命令,该命令显示类似的输出,但不遵守这些设置。</p></div></div></div>