summaryrefslogtreecommitdiff
path: root/content/posts
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2019-04-15 19:58:27 +0200
committerChristoph Cullmann <cullmann@kde.org>2019-04-15 19:58:27 +0200
commit2b1d4f53f5806efe5daeeb6c7b167ca54c633f54 (patch)
treee9f3554e0e5d92e9715937a656f9cf939ff42bb6 /content/posts
parent691ffdef2d10442648f2dbe72c499759993ad496 (diff)
tell the world about my fun with BFG
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/removing-files-from-git-history.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/content/posts/removing-files-from-git-history.md b/content/posts/removing-files-from-git-history.md
new file mode 100644
index 0000000..b3fa2bf
--- /dev/null
+++ b/content/posts/removing-files-from-git-history.md
@@ -0,0 +1,33 @@
+---
+title: "Removing Files from Git History"
+date: 2019-04-15T20:00:00+02:00
+draft: false
+categories: [git, development]
+tags: [git]
+---
+
+Today I did run again into an old problem:
+You need to archive a lot small and large files inside a single Git repository and you have no support for [Git LFS](https://git-lfs.github.com/) available.
+You did this several year and now you ended up in a state where cloning and working with the repository is unbearable slow.
+
+What now? Last time I did run into that, I archived the overfull repository to some "rest in peace" space and used `git filter-branch` to filter out no longer needed and too large objects from a repository copy that then will replace the old one for daily use.
+
+There are a lot of guides available how to use `git filter-branch` for that.
+All variants I ever used were complex to do and did take very long.
+Especially if you need several tries to get a sane set of stuff you want to remove to gain enough space savings.
+
+This time, I searched once more and stumbled on the [BFG Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/).
+And yes, it does what it promises on the web site and it seems to be trusted enough to be advertised by e.g. [GitHub](https://help.github.com/en/articles/removing-sensitive-data-from-a-repository), too.
+
+Just following the steps described on their [landing page](https://rtyley.github.io/bfg-repo-cleaner/) allows to shrink your stuff nicely and without a lot of round-trip time.
+
+If you still are just in the "experimenting" phase to see which space decrease one can archive with which file size filter (or which files you want to purge by removing them from master before running the tool), I recommend to swap the step
+
+> git reflog expire --expire=now --all && git gc --prune=now --aggressive
+
+with just
+
+> git reflog expire --expire=now --all && git gc --prune=now
+
+to not wait potential hours for the aggressive GC.
+For me that was good enough to get some estimate of the later size for my experiments before I settled to some final settings and did the real run.