uuid: - value: 63d82a82-4f85-440b-85d6-8c6a0cd0b5d9 langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T09:00:00+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: 'Rebase and reorder' created: - value: '2025-03-07T00:00:00+00:00' changed: - value: '2025-05-11T09:00:00+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2025/03/07/rebase-and-reorder langcode: en body: - value: |
Sometimes when tidying my commits or updating a local branch with remote changes, the order of commits changes - making them out of order in when running git log
.
I want the commits in the log to be in the correct sequential order.
If not, it would be confusing if I review the commits in the future.
This is easy to fix when running git rebase -i
to perform an interactive rebase on the commits.
The commit has a -x
or --exec
option that will perform a given command on each commit.
The commit date can be reset using git reset --amend
, and combining these commands will amend the date of each commit.
Running git rebase --interactive --exec "git commit --amend --no-edit --date now"
will amend and update each commit, keeping the commit message the same, but changing the commit date to the current time - leaving the Git log in the correct order.
Sometimes when tidying my commits or updating a local branch with remote changes, the order of commits changes - making them out of order in when running git log
.
I want the commits in the log to be in the correct sequential order.
If not, it would be confusing if I review the commits in the future.
This is easy to fix when running git rebase -i
to perform an interactive rebase on the commits.
The commit has a -x
or --exec
option that will perform a given command on each commit.
The commit date can be reset using git reset --amend
, and combining these commands will amend the date of each commit.
Running git rebase --interactive --exec "git commit --amend --no-edit --date now"
will amend and update each commit, keeping the commit message the same, but changing the commit date to the current time - leaving the Git log in the correct order.