{"id":1193,"date":"2022-11-07T18:20:05","date_gmt":"2022-11-07T18:20:05","guid":{"rendered":"https:\/\/editjournal.redakt.eu\/faxmodem\/?p=1193"},"modified":"2022-11-07T18:21:07","modified_gmt":"2022-11-07T18:21:07","slug":"reword-a-commit-message-without-changing-the-commit-date","status":"publish","type":"post","link":"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/development\/reword-a-commit-message-without-changing-the-commit-date\/","title":{"rendered":"Reword a commit message without changing the commit date"},"content":{"rendered":"<p>If you want to rebase-edit the commit message in an old commit, and keep the original commit date, you can do that using the <code>--committer-date-is-author-date<\/code> flag. Here's how:<\/p>\n<ol>\n<li>Find your old commit that you want to edit and copy its hash<\/li>\n<li>Run <code>git rebase -i hash^<\/code><\/li>\n<li>Find your commit in the list that shows up and type <code>edit<\/code> in front of it<\/li>\n<li>Run <code>git commit --amend<\/code> to enter editing mode for that commit, make your changes<\/li>\n<li>Type <code>git rebase --continue<\/code> to put the commit back into the history. At this point you will have all of the dates from your commit going forward rewritten to now<\/li>\n<li><strong>This<\/strong>. Run <code>git rebase --committer-date-is-author-date olderhash<\/code>, where <em>olderhash<\/em> is the hash of the commit just before the edited one which acts as a reference. All commits from the <em>olderhash<\/em>, starting with the just edited one, will have the dates restored to the corresponding authoring dates.<\/li>\n<\/ol>\n<p>The good news is this allows restoring the dates even after the rebase had been completed and all the dates seem to have been lost or overwritten.<\/p>\n<p>Sources:<\/p>\n<ul>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/1186535\/how-do-i-modify-a-specific-commit\">https:\/\/stackoverflow.com\/questions\/1186535\/how-do-i-modify-a-specific-commit<\/a><\/li>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/2973996\/git-rebase-without-changing-commit-timestamps\/2976598#2976598\">https:\/\/stackoverflow.com\/questions\/2973996\/git-rebase-without-changing-commit-timestamps\/2976598#2976598<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you want to rebase-edit the commit message in an old commit, and keep the original commit date, you can do that using the &#8211;committer-date-is-author-date flag. Here&#8217;s how: Find your old commit that you want to edit and copy its hash Run git rebase -i hash^ Find your commit in the list that shows up&hellip; <a class=\"more-link\" href=\"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/development\/reword-a-commit-message-without-changing-the-commit-date\/\">Continue reading <span class=\"screen-reader-text\">Reword a commit message without changing the commit date<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[706],"tags":[712],"class_list":["post-1193","post","type-post","status-publish","format-standard","hentry","category-development","tag-git","entry"],"_links":{"self":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/comments?post=1193"}],"version-history":[{"count":2,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1193\/revisions"}],"predecessor-version":[{"id":1196,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1193\/revisions\/1196"}],"wp:attachment":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/media?parent=1193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/categories?post=1193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/tags?post=1193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}