Skip to contentSkip to conversation

documentation: Explain how to free up space after filter-branch

PATCH New Thomas Jarosch 1 participant 1 message Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 documentation: Explain how to free up space after filter-branch

Explain how to free up space after filter-branch. Thanks to Björn Steinbrink for pointing me in the right direction.

The v2 version of this patch uses "git repack -a -d" instead of "git repack -a -d --depth=250 --window=250" as this nocked down a box with 4GB of ram using a repository with medium sized binary files (50 - 100mb).

Documentation/git-filter- renamed from Documentation/git-filter-branch.txt +0 -0

branch.txt
index fed6de6..1432380 100644

Documentation/git-filter-branch.txt +12 -0
@@ -319,6 +319,18 @@ git filter-branch --index-filter \
 	 mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
 ---------------------------------------------------------------
 
+Free up the space in .git if the rewritten version is correct
+by deleting refs/original and pruning the reflog:
+
+----------------------------------------------------
+git for-each-ref --format='%(refname)' refs/original
+	| xargs -i git update-ref -d {}
+
+git reflog expire --expire=0 --all
+git repack -a -d
+git prune
+----------------------------------------------------
+
 
 Author
 ------