A Real Message, Needing a Small Correction
The real commit that needs its message fixed sits several commits back — its content stays exactly as it is.
Rewording It, Scripted
GIT_SEQUENCE_EDITOR="sed -i '4s/^pick/reword/'" \
GIT_EDITOR="sed -i '1s/.*/Add dinner recipe (RECIPE-204)/'" \
git rebase -i HEAD~6
Exactly the same real scripting technique from Lesson 3.1.1 — reword marks the commit, GIT_EDITOR supplies the new real message.
The Real, Unavoidable Consequence
Every commit after the reworded one now shows a genuinely different hash — their real content is completely unchanged, but their parent isn't, and a commit's hash always depends on its parent.
A real, small correction: the "Add dinner recipe" commit, sitting 4 commits deep in this branch's real history, needs a ticket reference added to its message. Its actual content is completely fine — only the message needs to change.
reword pauses the rebase to let exactly that message be rewritten, then continues replaying everything after it. This is where the real, sometimes-surprising truth about git history becomes unavoidable: changing ANY commit — even just its message — genuinely changes its hash, and every commit built on top of it inherits a new parent, so it too gets a genuinely new hash. Content unchanged; hashes, changed all the way to the tip.
reword (in an interactive rebase)
Pauses the rebase to let exactly one real commit's message be rewritten, leaving its actual content completely untouched. Confirmed directly in this lab: the file diff of the reworded commit is byte-for-byte identical before and after.
Hash propagation
A commit's hash is computed from its content AND its parent's hash — change either, and the hash changes. Confirmed directly in this lab: rewording one commit's message alone was enough to give every later commit in the branch a genuinely new hash.
Takeaways
- reword pauses a rebase to rewrite exactly one commit's message, leaving its real content untouched
- A commit's hash depends on both its content AND its parent's hash
- Rewording one commit genuinely changes the hash of every real commit built on top of it, even with zero content changes
- Commits BEFORE the reworded one are never affected — only it and its real descendants