目录 搜索
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
文字

命名

git-commit-tree  - 创建一个新的提交对象

概要

git commit-tree <tree> [(-p <parent>)…]git commit-tree [(-p <parent>)…] [-S[<keyid>]] [(-m <message>)…]                  [(-F <file>)…] <tree>

描述

这通常不是最终用户想要直接运行的。请参阅git-commit [1]。

基于提供的树对象创建一个新的提交对象,并在stdout上发出新的提交对象ID。日志消息被从标准输入读取,除非-m-F选项中给出。

一个提交对象可以有任意数量的父母。只有一位家长,这是一个普通的提交。拥有多个父代使得提交在多行历史记录之间合并。初始(根)提交没有父母。

虽然树表示工作目录的特定目录状态,但提交表示“时间”中的状态,并说明如何到达那里。

通常一个提交会标识一个新的“HEAD”状态,尽管Git并不在乎你保存关于该状态的注释,但实际上我们倾向于只将结果写入指向的文件.git/HEAD,以便我们可以总是看看最近承诺的状态是什么。

选项

<tree>

现有的树对象

-p <parent>

每个-p表示一个父提交对象的ID。

-m <message>

提交日志消息中的段落。这可以不止一次给出,每个<message>成为它自己的段落。

-F <file>

从给定的文件中读取提交日志消息。用于-从标准输入读取。

-S<keyid>   --gpg-sign=<keyid>

GPG标志提交。该keyid参数是可选的,并且默认为提交者身份; 如果指定,它必须粘贴到选项没有空格。

--no-gpg-sign

不要GPG签名提交,以便--gpg-sign在命令行中反馈前面给出的选项。

提交信息

一个提交封装:

  • 所有父对象ID

  • 作者姓名,电子邮件和日期

  • 提交者名称和电子邮件以及提交时间。虽然在命令行上提供了父对象ID,但如果设置了作者和提交者信息,则会从以下环境变量中获取信息:GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE(nb“<”,“>”和“\ n”被删除)如果这些环境变量没有设置(某些),则信息从配置项user.name和user.email中获取,或者如果不存在,则会获取环境变量EMAIL,或,如果没有设置,那么系统用户名和用于发送邮件的/etc/mailname主机名(当该文件不存在时取回并返回到全限定主机名)。从stdin读取提交评论。如果没有通过“<”提供更改日志条目git commit-tree将只是等待一个输入,并与^ D.Date formatsThe终止GIT_AUTHOR_DATEGIT_COMMITTER_DATE环境变量支持以下日期格式:Git的内部格式是<unix timestamp> <time zone offset>,其中<unix timestamp>是从unix新纪元的秒数。<time zone offset>是UTC的正数或负数偏移量。例如CET(比UTC早1小时)是+0100。RFC 2822例如RFC 2822所描述的标准电子邮件格式Thu, 07 Apr 2005 22:13:13 +0200。ISO 8601例如,ISO 8601标准规定的时间和日期2005-04-07T22:13:13。解析器接受一个空格而不是T字符。注意此外,日期部分可以采用以下格式:YYYY.MM.DD,MM / DD / YYYY和DD.MM.YYYY.DiscussionGit在某种程度上是字符编码不可知。

  • blob对象的内容是未解释的字节序列。在核心层面没有编码翻译。

  • 路径名以UTF-8标准化形式C编码。这适用于树对象,索引文件,ref名称,以及命令行参数,环境变量和配置文件中的路径名.git/config(请参阅git-config [1]) ,gitignore [5],gitattributes [5]和gitmodules [5])。请注意,核心级别的Git将路径名称视为非NUL字节序列,不存在路径名称编码转换(Mac和Windows除外)。因此,即使在使用传统扩展ASCII编码的平台和文件系统上,使用非ASCII路径名也可以工作。但是,在这些系统上创建的存储库在基于UTF-8的系统(例如Linux,Mac,Windows)上无法正常工作,反之亦然。此外,许多基于Git的工具只是假设路径名称为UTF-8,并且无法正确显示其他编码。

  • 提交日志消息通常以UTF-8编码,但也支持其他扩展ASCII编码。这包括ISO-8859-x,CP125x和许多其他版本,但notUTF-16/32,EBCDIC和CJK多字节编码(GBK,Shift-JIS,Big5,EUC-x,CP9xx等)。

虽然我们鼓励提交日志消息使用UTF-8编码,但核心和Git瓷器都设计为不强制项目使用UTF-8。如果特定项目的所有参与者发现使用遗留编码更方便,Git不会禁止它。但是,有几件事要牢记。

  1. git commitgit commit-tree如和果提交给它的提交日志消息看起来不像一个有效的UTF-8字符串,则会发出警告,除非您明确声明您的项目使用了旧版编码。这样说的方式是在.git/config文件中使用i18n.commitencoding ,如下所示:i18n commitEncoding = ISO-8859-1Commit用上述设置创建的对象记录i18n.commitEncodingencoding标头中的值。这是为了帮助稍后看到他们的其他人。缺少这个头部意味着提交日志消息以UTF-8编码。

2. git loggit showgit blame和朋友看encoding一个提交对象的报头,并且尝试除非另有规定重新代码日志消息转换成UTF-8。您可以i18n.logOutputEncoding.git/config文件中指定所需的输出编码,如下所示:

i18n         logOutputEncoding = ISO-8859-1

如果您没有此配置变量,i18n.commitEncoding则会使用该值。

请注意,在提交对象级别强制使用UTF-8时,我们故意选择不重新编写提交日志消息,因为重新编码为UTF-8不一定是可逆操作。

文件

/etc/mailname

上一篇: 下一篇: