mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 15:04:05 +08:00
18 lines
21 KiB
HTML
18 lines
21 KiB
HTML
<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 [<options>…] [--] [<pathspec>…]</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=<version></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<mode> --untracked-files=<mode></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 = <when>查找更改时忽略对子模块的更改。<when>可以是“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 = <选项> --no-column在列中显示未跟踪的文件。有关选项语法,请参阅配置变量column.status。<code>--column--no-column</code>没有选项相当于<code>always</code>和<code>never</code>分别。<pathspec> ...请参阅<code>pathspec</code>gitglossary [7]中的条目。输出此命令的输出旨在用作提交模板注释。默认的长格式设计为人类可读,详细和描述性的。它的内容和格式随时可能发生变化。输出中提到的路径与其他许多Git命令不同,它是相对于当前目录而言的,如果您在子目录中工作(这是为了帮助剪切和粘贴)。请参阅下面的status.relativePaths配置选项。小格式在短格式中,每个路径的状态显示为XY PATH1 - > PATH2其中<code>PATH1</code>是路径<code>HEAD</code>,而“ <code>-> PATH2</code>”部分仅在显示时显示<code>PATH1</code>对应于索引/工作树中的不同路径(即文件被重命名)。这<code>XY</code>是一个双字母状态码。字段(包括<code>-></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>-></code>从重命名条目中忽略该字段,并且字段顺序颠倒(例如<code>from -> to</code>变成<code>to from</code>)。其次,NUL(ASCII 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 <commit> | (initial) Current commit.# branch.head <branch> | (detached) Current branch.# branch.upstream <upstream_branch> If upstream is set.# branch.ab +<ahead> -<behind> 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 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path></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 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath></pre></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript"> Field Meaning -------------------------------------------------------- <XY> 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. <sub> A 4 character field describing the submodule state."N..." when the entry is not a submodule."S<c><m><u>" when the entry is a submodule.<c> is "C" if the commit changed; otherwise ".".<m> is "M" if it has tracked changes; otherwise ".".<u> is "U" if there are untracked changes; otherwise ".". <mH> The octal file mode in HEAD. <mI> The octal file mode in the index. <mW> The octal file mode in the worktree. <hH> The object name in HEAD. <hI> The object name in the index. <X><score> The rename or copy score (denoting the percentageof similarity between the source and target of the
|
||
|
||
move or copy). For example "R100" or "C75". <path> The pathname. In a renamed/copied entry, thisis the path in the index and in the working tree. <sep> When the `-z` option is used, the 2 pathnames are separatedwith a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)byte separates them. <origPath> 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 <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path></pre></div></div><div class="doc-postil"><div class="c-markdown"><pre class="prism-token token language-javascript"> Field Meaning -------------------------------------------------------- <XY> A 2 character field describing the conflict typeas described in the short format. <sub> A 4 character field describing the submodule stateas described above. <m1> The octal file mode in stage 1. <m2> The octal file mode in stage 2. <m3> The octal file mode in stage 3. <mW> The octal file mode in the worktree. <h1> The object name in stage 1. <h2> The object name in stage 2. <h3> The object name in stage 3. <path> 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">? <path></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">! <path></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>给出该选项时,路径名将按原样打印并且不带任何引用,并且行以NUL(ASCII 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.<slot></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.<name>.ignore=all</code>。要查看忽略子模块的摘要,可以使用--ignore-submodules = dirty命令行选项或<code>git submodule summary</code>命令,该命令显示类似的输出,但不遵守这些设置。</p></div></div></div> |