<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Set – Yeri Tiete</title>
    <link>https://yeri.be/tag/set/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Sun, 08 Jun 2014 18:08:14 +0200</lastBuildDate>
    <atom:link href="https://yeri.be/tag/set/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Deleting big files from your git history</title>
      <link>https://yeri.be/deleting-big-files-from-your-git-history/</link>
      <pubDate>Sun, 08 Jun 2014 18:08:14 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/deleting-big-files-from-your-git-history/</guid>
      <description>&lt;p&gt;I committed a couple of big binary files, which eventually really slowed down Git.&lt;/p&gt;&#xA;&lt;p&gt;Unchanged: This is how you find them, and delete them:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Script&lt;/a&gt; (will show top 10 biggest files):&lt;/p&gt;&#xA;&lt;pre class=&#34;wp-block-code&#34;&gt;&lt;code&gt;#!/bin/bash&#xA;#set-x&#xA;# Shows you the largest objects in your repo&#39;s pack file.&#xA;# Written for osx.&#xA;# @see http://bit.ly/UmpwkV&#xA;&#xA;# @author Antony Stubbs&#xA;# set the internal field separator to line break,&#xA;# so that we can iterate easily over the verify-pack output&#xA;&#xA;IFS=$&#39;\n&#39;;&#xA;# list all objects including their size, sort by size, take top 10&#xA;objects=`git verify-pack -v .git/objects/pack/pack-*.idx | \&#xA;grep -v chain | sort -k3nr | head`&#xA;&#xA;echo &#34;All sizes are in kB&#39;s. The pack column is the size of the object, \&#xA;compressed, inside the pack file.&#34;&#xA;&#xA;output=&#34;size,pack,SHA,location&#34;&#xA;for y in $objects&#xA;do&#xA;&#x9;# extract the size in bytes&#xA;&#x9;size=$((`echo $y | cut -f 5 -d &#39; &#39;`/1024))&#xA;&#x9;# extract the compressed size in bytes&#xA;&#x9;compressedSize=$((`echo $y | cut -f 6 -d &#39; &#39;`/1024))&#xA;&#x9;# extract the SHA&#xA;&#x9;sha=`echo $y | cut -f 1 -d &#39; &#39;`&#xA;&#x9;# find the objects location in the repository tree&#xA;&#x9;other=`git rev-list --all --objects | grep $sha`&#xA;&#x9;#lineBreak=° echo e &#34;\n&#34;*&#xA;&#x9;output=&#34;${output}\n${size},${compressedSize},${other}&#34;&#xA;done&#xA;echo -e $output | column -t -s &#39;, &#39;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And &lt;a href=&#34;https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;then&lt;/a&gt;:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I committed a couple of big binary files, which eventually really slowed down Git.</p>
<p>Unchanged: This is how you find them, and delete them:</p>
<p><a href="http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/" target="_blank" rel="noopener">Script</a> (will show top 10 biggest files):</p>
<pre class="wp-block-code"><code>#!/bin/bash
#set-x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
# @see http://bit.ly/UmpwkV

# @author Antony Stubbs
# set the internal field separator to line break,
# so that we can iterate easily over the verify-pack output

IFS=$'\n';
# list all objects including their size, sort by size, take top 10
objects=`git verify-pack -v .git/objects/pack/pack-*.idx | \
grep -v chain | sort -k3nr | head`

echo "All sizes are in kB's. The pack column is the size of the object, \
compressed, inside the pack file."

output="size,pack,SHA,location"
for y in $objects
do
	# extract the size in bytes
	size=$((`echo $y | cut -f 5 -d ' '`/1024))
	# extract the compressed size in bytes
	compressedSize=$((`echo $y | cut -f 6 -d ' '`/1024))
	# extract the SHA
	sha=`echo $y | cut -f 1 -d ' '`
	# find the objects location in the repository tree
	other=`git rev-list --all --objects | grep $sha`
	#lineBreak=° echo e "\n"*
	output="${output}\n${size},${compressedSize},${other}"
done
echo -e $output | column -t -s ', '</code></pre>
<p>And <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository" target="_blank" rel="noreferrer noopener">then</a>:</p>
<pre class="wp-block-code"><code>git filter-branch-force--index-filter \
'git rm-cached-ignore-unmatch $some/file/you/dont/want' \
--prune-empty --tag-name-filter cat -- --all
git push origin master --force</code></pre>
<p>Elsewhere, you'll need to <code>rebase</code>:</p>
<pre class="wp-block-code"><code>git pull--rebase</code></pre>
]]></content:encoded>
      <category>linux</category><category>software</category>
      <category>git</category><category>linebreak</category><category>set</category>
    </item>
    
  </channel>
</rss>
