git rebase - 我的哈希意外不匹配

Dus*_*etz 1 git

1)为什么我没有机会进行我的提交,所以我可以在与团队合并之前将它们变成不同的提交?2)为什么rebase之前的哈希值不等于rebase之后的哈希值?我没有看到任何消息表明存在压扁的空白或其他东西.

GIT [work]  git log --oneline -n10
7784ea8 dataloader populates with relatively sane data for masteritem and event; some component changes
1d9b3fe masterlist, promote draft, various commands, display tweaks on all components
76bea59 display strings
...
GIT [work]  git rebase -i team
Run Code Online (Sandbox Code Playgroud)

编辑第一次提交,压缩下两次提交

Stopped at 76bea59... display strings
You can amend the commit now, with

        git commit --amend

Once you are satisfied with your changes, run

        git rebase --continue

PS [55] git status
# Not currently on any branch.
nothing to commit (working directory clean)
PS [56] git rebase --continue
[detached HEAD e373567] display strings
 49 files changed, 917 insertions(+), 460 deletions(-)
 delete mode 100644 source/...
 delete mode 100644 source/...
 delete mode 100644 source/...
 ...
Successfully rebased and updated refs/heads/work.
GIT [work]  git log --oneline -n10
e373567 display strings
bddc2fe unit test for object attrs, verify repeating in framework
548e1e9 sync with cvs; fixed test case compile error
Run Code Online (Sandbox Code Playgroud)

Paŭ*_*ann 11

你在评论中写道:

我所说的是,我的OP中的rebase的最终结果没有变化,所以即使rebase(根据定义)不保留提交历史,它只是发生了旧头的sha1哈希和sha1哈希的尽管是单独的提交,但新的头部预计是相同的,因为它们的文本内容完全相同

提交的哈希取决于:

  1. 此提交的树(即您的源的当前状态)
  2. 提交的任何父母的哈希
  3. 提交元数据(作者日期,作者,提交日期,提交者,提交消息等).

在你的rebase之后,第一个是相同的,也许(我不确定)甚至是最后一个(至少,它的一部分).但肯定第二个不一样,因此你得到另一个commit-ID.这是一件好事,因为它允许您同时拥有存储库中的原始和新提交.