繁体   English   中英

为什么git cherry-pick创建不同的校验和?

[英]why does git cherry-pick create a different checksum?

在以下会话中,为什么git cherry-pick的结果与复制的提交没有相同的校验和? 它具有相同的注释,作者,日期和父代。 我不考虑的校验和中还有什么?

谢谢。

~$  mkdir tmp
~$ cd tmp/
~/tmp$ git init
Initialized empty Git repository in /home/sinclairs/projects/tmp/.git/

~/tmp$ echo "asdf" >asdf
~/tmp$ git add asdf
~/tmp$ git commit -m asdf
[master (root-commit) 7d0aaa3] asdf
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 asdf

~/tmp$ echo "fdsa" >asdf
~/tmp$ git commit -a -m asdf2
[master b392367] asdf2
 1 files changed, 1 insertions(+), 1 deletions(-)

~/tmp$ git log --format=oneline
b3923677106db9371faf55ed2cb8c7d06f586f7f asdf2
7d0aaa3937de390b7a119c73dbf9428126c1bac5 asdf

~/tmp$ git checkout -b mybranch HEAD^
Switched to a new branch 'mybranch'

~/tmp$ git cherry-pick master
Finished one cherry-pick.
[mybranch ca92f66] asdf2
 1 files changed, 1 insertions(+), 1 deletions(-)

~/tmp$ git log --format=oneline
ca92f666cc53715c6b5ae2975b938275e0d20f73 asdf2
7d0aaa3937de390b7a119c73dbf9428126c1bac5 asdf

文档中

git cherry-pick master
    Apply the change introduced by the commit at the tip of the master branch and create a new commit with this change.

新的提交日期不同。

作者日期相同,但提交日期不同。

您可以使用它实际看到差异。

git cat-file -p b3923677106db9
git cat-file -p ca92f666cc5371

作者行是相同的,提交人行的日期是不同的。

即使您可以调整提交日期(可能的话),树和父项也不同,您无法更改它们!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM