A change involved both restructuring file locations and modifying file content. Following the advice of this answer to ensure that git interprets my git mv
changes as rename
rather than delete
/create
, I split the change into two separate commits.
commit 70c9cf5ab06b1838b1b7c4b8278728bedbaecbf5 (HEAD -> main)
Author: Michael Moreno <[email protected]>
Date: Fri Apr 7 22:44:01 2023 -0600
:classical_building: `arch` Character,Item ⊃ Entity ⊃ StateMachine :diamond_shape_with_a_dot_inside: `add` Effect/Immunity/Spell system
commit 62a0309e8dd083af9ba2d76ff1ed0614ff33a851
Author: Michael Moreno <[email protected]>
Date: Fri Apr 7 07:55:02 2023 -0600
:exclamation::recycle: `env` mv characters/ items/ into entities/
Since the earlier commit was auxiliary to the later, I would like to add a reference to the later commit in the older commit's message body
Like so
:exclamation::recycle: `env` mv characters/ items/ into entities/
WARNING: Not a standalone commit, auxiliary to 70c9cf5.
I attempt to do this using
git rebase -i 62a0309e8dd083af9ba2d76ff1ed0614ff33a851^
and marking the commit with reword
, but when I save the new commit message it appears to regenerate a new commit id for the later commit (no longer 70c9cf5), and when pushed GitHub shows
This commit does not belong to any branch on this repository, and
may belong to a fork outside of the repository.
Running git log
shows an entirely new commit id for the most recent commit.
Is there a way to refer to recent commits in the message body of older commits without resulting in the recent commit id to be generated?
Is there a way to refer to recent commits in the message body of older commits without resulting in the recent commit id to be generated?
Not with the exact commit id. Just refer to it as "the next commit" or "a following commit" and include the commit message.
Pre-calculating the resulting commit id is impossible since the commit among other things is based on the time of date when it is created. You could possibly refer to the git tree object which should stay the same, but that is not a particular useful reference for anyone reading the history later.