哪个是管道和瓷器命令?

zer*_*uno 43 git

对于git命令,"plumbing"和"porcelain"命令之间存在区别.如何确定哪些将被分类为管道或瓷器?即允许我区分的边界线是什么?

我不是在问瓷器或管道命令是什么,而是如何根据命令我可以说它是哪种类型.

tor*_*rek 42

正如blue112所指出的,分界线是模糊的. 然而,第一个文档页面有一个明确的列表(并且如下面的RM说明,一个主要标准是,或者至少应该是,界面的稳定性 - 一些名义上的瓷器命令有--porcelain1强制更稳定和/或更多机器可读输出).您可以选择使用它们的列表,或者确定某些命令的级别太高而不是低级别,或者级别太低而不能达到高级别.例如,您可能不同意这git apply是一个管道命令,但Git页面说它是.或者,您可能会认为git fast-import某些内容只能在脚本中使用.

下面的列表只是从文档中提取,描述和其他分类被剥离,只留下"瓷器"与"管道".(子分类在字母排序顺序中仍然可见.我没有为每个条目构建链接,因为使用StackOverflow markdown会更加困难 - 这只需要一个简单的<pre> ... </ pre>包装器.)

git-add                 git-rebase              git-cherry
git-am                  git-reset               git-count-objects
git-archive             git-revert              git-difftool
git-bisect              git-rm                  git-fsck
git-branch              git-shortlog            git-get-tar-commit-id
git-bundle              git-show                git-help
git-checkout            git-stash               git-instaweb
git-cherry-pick         git-status              git-merge-tree
git-citool              git-submodule           git-rerere
git-clean               git-tag                 git-rev-parse
git-clone               git-worktree            git-show-branch
git-commit              gitk                    git-verify-commit
git-describe            git-config              git-verify-tag
git-diff                git-fast-export         git-whatchanged
git-fetch               git-fast-import         gitweb
git-format-patch        git-filter-branch       git-archimport
git-gc                  git-mergetool           git-cvsexportcommit
git-grep                git-pack-refs           git-cvsimport
git-gui                 git-prune               git-cvsserver
git-init                git-reflog              git-imap-send
git-log                 git-relink              git-p4
git-merge               git-remote              git-quiltimport
git-mv                  git-repack              git-request-pull
git-notes               git-replace             git-send-email
git-pull                git-annotate            git-svn
git-push                git-blame

水暖

git-apply               git-for-each-ref        git-receive-pack
git-checkout-index      git-ls-files            git-shell
git-commit-tree         git-ls-remote           git-upload-archive
git-hash-object         git-ls-tree             git-upload-pack
git-index-pack          git-merge-base          git-check-attr
git-merge-file          git-name-rev            git-check-ignore
git-merge-index         git-pack-redundant      git-check-mailmap
git-mktag               git-rev-list            git-check-ref-format
git-mktree              git-show-index          git-column
git-pack-objects        git-show-ref            git-credential
git-prune-packed        git-unpack-file         git-credential-cache
git-read-tree           git-var                 git-credential-store
git-symbolic-ref        git-verify-pack         git-fmt-merge-msg
git-unpack-objects      git-daemon              git-interpret-trailers
git-update-index        git-fetch-pack          git-mailinfo
git-update-ref          git-http-backend        git-mailsplit
git-write-tree          git-send-pack           git-merge-one-file
git-cat-file            git-update-server-info  git-patch-id
git-diff-files          git-http-fetch          git-sh-i18n
git-diff-index          git-http-push           git-sh-setup
git-diff-tree           git-parse-remote        git-stripspace

1这称为更合乎逻辑--plumbing,但正如VonC在这个相关问题的答案中所指出的那样,人们可以将其视为一个请求:"我正在实施瓷器,所以请给我管道式输出." 这个论点中的缺陷是你可能正在实施复杂的管道,并希望使用简单的管道来做到这一点:现在看不到瓷器了,然而,你的复杂管道传递--porcelain到一些简单的管道.

  • [这个答案](http://stackoverflow.com/a/6978402/3022952) 和您链接的文档表明,从 git 维护者的角度来看,瓷器命令和管道命令之间的主要分界线是接口的稳定性/输出。Porcelain 命令旨在用于直接的人机交互,并且可能没有稳定格式的输出(即,版本之间的微小格式更改可能会破坏后处理脚本)。管道命令的输出旨在由自动化脚本进行解析,因此版本之间会更加稳定。 (3认同)

blu*_*112 6

我认为命令之间没有直线.

您使用每天都在命令瓷都(想想status,diff,commit...),少用命令,少给格式化输出管道(想想diff-index,hash-objectsend-pack).

您可以使用完整的git命令列表git help -a.这里很容易告诉哪个命令更属于瓷器或管道工程.

查看手册,git send-pack您可以看到以下行

通常你会想要使用git push,它是这个命令的更高级别的包装器.

这就是告诉你它更像是一个管道命令.

  • "我认为命令之间没有直线." 似乎与"在这里告诉哪个命令是哪个很容易"相矛盾. (4认同)

Von*_*onC 5

列出管道命令(以及其他命令,在它们自己的部分中)的实际命令是:

git help -av
Run Code Online (Sandbox Code Playgroud)

这来自git/git/command-list.txt.

而这随着 Git 2.20(2018 年第四季度)发生了变化,考虑到“ git help -a”和“ git help -av”给出的信息不同,通常“详细”版本对新用户更友好。

git help -a”现在默认使用更详细的输出(使用“ --no-verbose”,你可以回到原来的状态)。

请参阅Nguy?n Thái Ng?c Duy ( ) 的commit 26c7d06(2018 年 9 月 29 日(由Junio C Hamano合并-- --commit 54e564e,2018 年 10 月 19 日)pclouds
gitster

help -a: 改进并设为--verbose默认值

当您键入“ git help”(或仅“ git”)时,您会看到一个包含常用命令及其简短描述的列表,建议使用“ git help -a”或“ git help -g”了解更多详细信息。

" git help -av" 会更友好并与 " git help" 显示的内容内联,因为它也显示了带有描述的命令列表,并且命令被正确分组。

" help -av" 并没有显示 " help -a" 显示的所有内容。为此,
在“ help -av”中添加外部命令部分。在那里,也为别名添加一个部分(直到现在别名没有 UI,只有“ git config”)。

一个简单的git help -a(使用 Git 2.20+)现在将返回:

vonc@VONC D:\git\git
> git help -a
Main Porcelain Commands
   add                  Add file contents to the index
   am                   Apply a series of patches from a mailbox
   archive              Create an archive of files from a named tree
   bisect               Use binary search to find the commit that introduced a bug
...
Run Code Online (Sandbox Code Playgroud)

使用 Git 2.25(2020 年第一季度),命令列表更加完整。

请参阅Philippe Blain ( ) 的commit 762d5b4(2019 年 10 月 28 日(由Junio C Hamano合并-- --ecbddd1 提交中,2019 年 12 月 1 日)phil-blain
gitster

help: 添加gitsubmodules到指南列表

签字人:Philippe Blain
评论人:Jonathan Nieder

gitsubmodulesd480345中添加了指南“ ” (“ submodules:大修文档”,2017-06-22,Git v2.14.0-rc0 --合并批次#0 中列出),但在提交时未添加到 command-list.txt 1b81d8c (" help: use command-list.txtfor the source of guides", 2018-05-20, Git v2.18.0-rc1 -- merge ) 教 " git help" 从这个文件中获取指南列表。

现在添加它,并将 描述的第一个单词大写gitsubmodules,如1b81d8c(“ helpcommand-list.txt用于指南的来源”,2018 年 5 月 20 日,Git v2.18.0-rc1 -- merge)作为其他指南.