Is there a way to do git rebase with keeping the existing commit hashes? -
imagine scenario project has existing git tree you're 100% satisfied with. discover ancient source code predating migration git , make part of git history.
there many ways how achieve knowledge ends new git tree, i.e. existing commits have different ids.
in specific case doesn't seem necessary, i'm not changing first commit's parent. there way this?
no, fundamentally impossible. commit’s id hash of combined content. includes not whole tree , file content, commit message, author information, and reference parent.
so changing parent of commit, changing content , such invalidate previous id. git have recalculate hash in order integrate commit history. otherwise reject commit being broken , leave repository in broken state.
the fact commit id matches hash of content, , true direct or indirect parent core part of git’s integrity. cannot avoid this.
so no, cannot want without affecting commit hashes. maybe add unrelated branch has no connection current branches. way wouldn’t affect existing commits have way integrate old history repository stored inside—not integrated @ least it’s there.
Comments
Post a Comment