在以下会话中,为什么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
答案 0 :(得分:5)
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.
新的提交日期不同。
答案 1 :(得分:3)
作者日期相同,但提交日期不同。
你可以用它来实际看到差异。
git cat-file -p b3923677106db9
git cat-file -p ca92f666cc5371
作者行相同,提交者行日期不同。
答案 2 :(得分:2)
即使您要调整提交日期(可能),树和父级也不同,您无法更改它们!