{"id":1596,"date":"2014-09-12T11:15:33","date_gmt":"2014-09-12T10:15:33","guid":{"rendered":"http:\/\/denbeke.be\/blog\/?p=1596"},"modified":"2014-09-12T11:16:49","modified_gmt":"2014-09-12T10:16:49","slug":"git-author-en-email-aanpassen-in-history","status":"publish","type":"post","link":"https:\/\/denbeke.be\/blog\/software\/git-author-en-email-aanpassen-in-history\/","title":{"rendered":"Git: author en email aanpassen in history"},"content":{"rendered":"<p>Het gebeurt al wel eens dat je in een commit de verkeerde author of email hebt staan. Als je zo een reeks commits hebt in een project, kan je met een shell script alle commits herschrijven.<\/p>\n<pre><code>#!\/bin\/sh\r\n \r\ngit filter-branch --env-filter '\r\n \r\nan=\"$GIT_AUTHOR_NAME\"\r\nam=\"$GIT_AUTHOR_EMAIL\"\r\ncn=\"$GIT_COMMITTER_NAME\"\r\ncm=\"$GIT_COMMITTER_EMAIL\"\r\n \r\nif [ \"$GIT_COMMITTER_EMAIL\" = \"old_mail@example.com\" ] || [ \"$GIT_COMMITTER_EMAIL\" = \"another_old_mail_to_change@example.com\" ]\r\nthen\r\n    cn=\"New Name\"\r\n    cm=\"new_email@example.com\"\r\nfi\r\n\r\nif [ \"$GIT_AUTHOR_EMAIL\" = \"old_mail@example.com\" ] || [ \"$GIT_AUTHOR_EMAIL\" = \"another_old_mail_to_change@example.com\" ]\r\nthen\r\n    an=\"New Name\"\r\n    am=\"new_email@example.com\"\r\nfi\r\n \r\nexport GIT_AUTHOR_NAME=\"$an\"\r\nexport GIT_AUTHOR_EMAIL=\"$am\"\r\nexport GIT_COMMITTER_NAME=\"$cn\"\r\nexport GIT_COMMITTER_EMAIL=\"$cm\"\r\n' -f -- --all<\/code><\/pre>\n<p>Nadien moet je dan wel\u00a0geforceerd pushen.<\/p>\n<pre><code>git push --force<\/code><\/pre>\n<p>Wel opletten als er nog andere mensen zijn die een lokale versie hebben van de repo&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Het gebeurt al wel eens dat je in een commit de verkeerde author of email hebt staan. Als je zo een reeks commits hebt in een project, kan je met een shell script alle commits herschrijven. #!\/bin\/sh git filter-branch &#8211;env-filter &#8216; an=&#8221;$GIT_AUTHOR_NAME&#8221; am=&#8221;$GIT_AUTHOR_EMAIL&#8221; cn=&#8221;$GIT_COMMITTER_NAME&#8221; cm=&#8221;$GIT_COMMITTER_EMAIL&#8221; if [ &#8220;$GIT_COMMITTER_EMAIL&#8221; = &#8220;old_mail@example.com&#8221; ] || [ &#8220;$GIT_COMMITTER_EMAIL&#8221; = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[161],"tags":[210,211],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.6.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Git: author en email aanpassen in history &ndash; DenBeke<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/denbeke.be\/blog\/software\/git-author-en-email-aanpassen-in-history\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git: author en email aanpassen in history &ndash; DenBeke\" \/>\n<meta property=\"og:description\" content=\"Het gebeurt al wel eens dat je in een commit de verkeerde author of email hebt staan. Als je zo een reeks commits hebt in een project, kan je met een shell script alle commits herschrijven. #!\/bin\/sh git filter-branch --env-filter &#039; an=&quot;$GIT_AUTHOR_NAME&quot; am=&quot;$GIT_AUTHOR_EMAIL&quot; cn=&quot;$GIT_COMMITTER_NAME&quot; cm=&quot;$GIT_COMMITTER_EMAIL&quot; if [ &quot;$GIT_COMMITTER_EMAIL&quot; = &quot;old_mail@example.com&quot; ] || [ &quot;$GIT_COMMITTER_EMAIL&quot; = [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/denbeke.be\/blog\/software\/git-author-en-email-aanpassen-in-history\/\" \/>\n<meta property=\"og:site_name\" content=\"DenBeke\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-12T10:15:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-09-12T10:16:49+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@MthsBk\" \/>\n<meta name=\"twitter:site\" content=\"@MthsBk\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"1 minute\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/denbeke.be\/blog\/#website\",\"url\":\"https:\/\/denbeke.be\/blog\/\",\"name\":\"DenBeke\",\"description\":\"Mathias Beke\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/denbeke.be\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/denbeke.be\/blog\/software\/git-author-en-email-aanpassen-in-history\/#webpage\",\"url\":\"https:\/\/denbeke.be\/blog\/software\/git-author-en-email-aanpassen-in-history\/\",\"name\":\"Git: author en email aanpassen in history &ndash; DenBeke\",\"isPartOf\":{\"@id\":\"https:\/\/denbeke.be\/blog\/#website\"},\"datePublished\":\"2014-09-12T10:15:33+00:00\",\"dateModified\":\"2014-09-12T10:16:49+00:00\",\"author\":{\"@id\":\"https:\/\/denbeke.be\/blog\/#\/schema\/person\/386878f712fe3fe22227216f087772dc\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/denbeke.be\/blog\/software\/git-author-en-email-aanpassen-in-history\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/denbeke.be\/blog\/#\/schema\/person\/386878f712fe3fe22227216f087772dc\",\"name\":\"Mathias Beke\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/denbeke.be\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/015ba35e6ce4f5859e3888ca99807575?s=96&d=mm&r=g\",\"caption\":\"Mathias Beke\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/1596"}],"collection":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/comments?post=1596"}],"version-history":[{"count":3,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/1596\/revisions"}],"predecessor-version":[{"id":1599,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/1596\/revisions\/1599"}],"wp:attachment":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/media?parent=1596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/categories?post=1596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/tags?post=1596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}