git rebase -i — why is it changing commit hashes?

前端 未结 5 1036
情书的邮戳
情书的邮戳 2021-02-05 17:09

So I\'m more or less familiar with how rebasing works, but up until recently I usually just did a git rebase -i HEAD~20, and modified whatever needed to be modified

5条回答
  •  隐瞒了意图╮
    2021-02-05 18:07

    From the rebase doc:

    The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order.

    When the commits are "reapplied" it's really creating a brand new commit...it's content may be the same, but it will have a different timestamp which is part of how it's SHA is generated...thus the new commits will have a new SHA's.

    You can read more about how SHA's are calculated here.

提交回复
热议问题