<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=Git%2FHistory%2FRewriting</id>
	<title>Git/History/Rewriting - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=Git%2FHistory%2FRewriting"/>
	<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Git/History/Rewriting&amp;action=history"/>
	<updated>2026-06-20T14:53:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.12</generator>
	<entry>
		<id>https://charlesreid1.com/w/index.php?title=Git/History/Rewriting&amp;diff=25067&amp;oldid=prev</id>
		<title>Admin at 21:23, 18 September 2018</title>
		<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Git/History/Rewriting&amp;diff=25067&amp;oldid=prev"/>
		<updated>2018-09-18T21:23:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:23, 18 September 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l80&quot;&gt;Line 80:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 80:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You could write a more complex script which views the contents of that tree and sets the date appropriately.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You could write a more complex script which views the contents of that tree and sets the date appropriately.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Git]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Git History]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Rewriting Git History]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff::1.12:old-25066:rev-25067 --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://charlesreid1.com/w/index.php?title=Git/History/Rewriting&amp;diff=25066&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;via https://www.reddit.com/r/git/comments/2pjgsx/git_how_do_i_modify_timestamps_on_commit_objects/  ==How to modify entire commit history==  Suppose you want to modify your en...&quot;</title>
		<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Git/History/Rewriting&amp;diff=25066&amp;oldid=prev"/>
		<updated>2018-09-18T21:23:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;via https://www.reddit.com/r/git/comments/2pjgsx/git_how_do_i_modify_timestamps_on_commit_objects/  ==How to modify entire commit history==  Suppose you want to modify your en...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;via https://www.reddit.com/r/git/comments/2pjgsx/git_how_do_i_modify_timestamps_on_commit_objects/&lt;br /&gt;
&lt;br /&gt;
==How to modify entire commit history==&lt;br /&gt;
&lt;br /&gt;
Suppose you want to modify your entire git commit history. To do that, you can use the &amp;lt;code&amp;gt;git filter-branch&amp;lt;/code&amp;gt; command to run a command/script on every commit that can be reached from HEAD (i.e., starting from HEAD and traversing backwards to root).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git filter-branch --commit-filter CMD &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CMD&amp;lt;/code&amp;gt; is a command that is passed the same arguments as &amp;lt;code&amp;gt;git commit-tree&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It should do what &amp;lt;code&amp;gt;git commit-tree&amp;lt;/code&amp;gt; does.&lt;br /&gt;
&lt;br /&gt;
(Which is...?)&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s an example (executable) shell script called &amp;lt;code&amp;gt;/tmp/rewrite.sh&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
export GIT_AUTHOR_DATE=1234567890+0000&lt;br /&gt;
export GIT_COMMITTER_DATE=1234567890+0000&lt;br /&gt;
git commit-tree &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when you rewrite the history, the entire history will appear to have been committed at the same timestamp, 1234567890:&lt;br /&gt;
&lt;br /&gt;
Before:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git log&lt;br /&gt;
commit 21a52d0c3a27faa1f8a0c3dc894ffb3f529b0d65&lt;br /&gt;
Author: Your Name&lt;br /&gt;
Date:   Tue Dec 16 23:50:51 2014 -0500&lt;br /&gt;
&lt;br /&gt;
    second commit&lt;br /&gt;
&lt;br /&gt;
commit 2e7a613b24c55ba383440a88dc9b5b55cddca5ad&lt;br /&gt;
Author: Your Name&lt;br /&gt;
Date:   Tue Dec 16 23:50:38 2014 -0500&lt;br /&gt;
&lt;br /&gt;
    first commit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apply git filter-branch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git filter-branch --commit-filter &amp;#039;/tmp/rewrite.sh &amp;quot;$@&amp;quot;&amp;#039;&lt;br /&gt;
Rewrite 21a52d0c3a27faa1f8a0c3dc894ffb3f529b0d65 (2/2)&lt;br /&gt;
Ref &amp;#039;refs/heads/master&amp;#039; was rewritten&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ git log&lt;br /&gt;
commit 15bf1d225ffb17103e0476687dcd6e0a5ce683c8&lt;br /&gt;
Author: Your Name&lt;br /&gt;
Date:   Fri Feb 13 23:31:30 2009 +0000&lt;br /&gt;
&lt;br /&gt;
    second commit&lt;br /&gt;
&lt;br /&gt;
commit b864f505b2a923b69f9da8dc7cb1c19d45dad92f&lt;br /&gt;
Author: Your Name&lt;br /&gt;
Date:   Fri Feb 13 23:31:30 2009 +0000&lt;br /&gt;
&lt;br /&gt;
    first commit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Original refs are still stored in &amp;lt;code&amp;gt;.git/refs/original&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat .git/refs/original/refs/heads/master&lt;br /&gt;
21a52d0c3a27faa1f8a0c3dc894ffb3f529b0d65&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The filter command is passed the same arguments as git commit-tree.&lt;br /&gt;
&lt;br /&gt;
The first argument will be the tree of the commit to rewrite.&lt;br /&gt;
&lt;br /&gt;
You could write a more complex script which views the contents of that tree and sets the date appropriately.&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>