Reputation: 410
A -- B -- C <-- master
\
D -- E <-- your-cool-branch
I've realized there are some typo in my source code comments in commit D. I would still like to submit the pull request as two commits D' and E', where D' is the fixed version of D, and E' is the same exact diff as E.
If I rebase do to make this happen will the E' commit hash be the same E? Why or why not?
I have tried replicating this but I must not be rebasing correctly.
Upvotes: 1
Views: 82
Reputation: 1323045
First, any rebase would, be definition, change E' SHA1 commit, since the parent won't be the same: it will be D' whose new parent after rebase (C) will have changed from B before.
Plus D itself is modified by your fix.
So after a git rebase master
:
A -- B -- C <-- master
\
D' -- E' <-- your-cool-branch
See "The anatomy of a Git commit" from Christoph Burgdorf: a commit ID would include:
sha1(
commit message => "second commit"
committer => Christoph Burgdorf <[email protected]>
commit date => Sat Nov 8 11:13:49 2014 +0100
author => Christoph Burgdorf <[email protected]>
author date => Sat Nov 8 11:13:49 2014 +0100
tree => 9c435a86e664be00db0d973e981425e4a3ef3f8d
parents => [0d973e9c4353ef3f8ddb98a86e664be001425e4a]
)
Or: Git Object model
Upvotes: 2