git rebase — unexpected mismatch of my hashes

后端 未结 3 1057
迷失自我
迷失自我 2021-01-24 22:07

1) why wasn\'t i given an opportunity to stage pieces of my commits so i can tease them into distinct commits before merging with team? 2) why doesn\'t the hash before

3条回答
  •  执念已碎
    2021-01-24 22:36

    Rebase creates completely new commits (that means new commit IDs). That's why you shouldn't use rebase on anything that is publicly available since your rebase will break everyone's else repositories.

    From a comment... "the commit ID is a hash of the state of the commit and the commit metadata, including the parent IDs. as soon as you change any metadata in a commit, all its descendants are affected. In the case you describe, I'd expect your old and new heads to have the same tree ID, since they represent no content change, but still different commit IDs since the commit graph has changed."

提交回复
热议问题