目录 搜索
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-patch-id  - 计算补丁的唯一 ID

概要

git patch-id [--stable | --unstable]

描述

从标准输入中读取补丁并为其计算补丁 ID。

“补丁ID”只不过是与补丁相关的文件差异的 SHA-1之和,忽略空白和行号。因此,它“相当稳定”,但同时也是相当独特的,即具有相同“补丁ID”的两个补丁几乎保证是相同的东西。

IOW,你可以使用这个东西来寻找可能的重复提交。

在处理git diff-tree输出时,它利用了补丁前缀为提交的对象名称并输出两个40字节的十六进制字符串的事实。第一个字符串是补丁ID,第二个字符串是提交ID。这可以用来制作从补丁ID到提交ID的映射。

选项

--stable

使用“稳定”的哈希总和作为补丁 ID。有了这个选项:

  • 重新排序组成补丁的文件差异不会影响ID。特别是,通过将相同的两棵树与“-O <orderfile>”的两个不同设置进行比较而产生的两个补丁导致相同的补丁ID签名,从而允许计算结果用作索引关于两棵树之间的变化;

  • 结果与 git 1.9及更早版本产生的值不同,或者当配置了“unstable”散列(请参阅下面的--unstable)时产生的值 - 即使在不使用“-O <orderfile>”的情况下使用差异输出时,从而使现有数据库存储这种“不稳定”或历史补丁ID不可用。

如果 patchid.stable 设置为 true,这是默认值。

--unstable

使用“unstable”散列作为修补程序ID。使用此选项,产生的结果与 git 1.9及更早版本生成的 patch-id 值兼容。预先存在的数据库存储由 git 1.9及更高版本(不涉及重新排序的补丁)生成的补丁id的用户可能需要使用此选项。

This is the default.
上一篇: 下一篇: