Does anyone have any experience 'cleaning up' git ...
# random
j
Does anyone have any experience 'cleaning up' git repos? I've got one (not nf-core 😅 ) that is mostly just small tables and a few images, however due to some automated generation of PNG files, the git pack files are huge (so the whole repo is unnecessarily now 23MB...)... I've read about a tool called
bfg
but it seems 'dangerous' and I'm scared of breaking things...
e
I’ve done it a bit
j
Any suggestions/recommendations?
e
Converting them to lfs if you want to keep them around is pretty easy
Do you just want them out of the repo all together?
j
Yeah
I don't really need them (I've switch to SVGs everywhere)
e
Okay, anyone else working on the repo? I'd probably do: 1. Make a backup of the repo on github 2.
bfg --delete-files "*.png"
3.
Copy code
$ cd some-big-repo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
1.
git push -f
2. let anyone using the repo know
❤️ 1
j
I can stop people for a while at least... but yes it's collaborative
e
They'll probably want to rebase their branches is all
👍 1
j
Thank you very much, I will try and bite the bullet soon and try that 😆
e
Yeah, long winded answer on my part 😆 TL;DR not rocket science, I'd just have multiple backups and it'll be weird with people your collaborating with but nothing a fresh clone can't fix
j
No not at all, it';s what I appreciate! It's more concise than the bfg docs which are superpowered but seems intimidating...
❤️ 1
p
Yeah bfg is good but it rewrites history which is why you need to use it with caution
☝️ 1
Note the
--force
flag in the
git push
above
25 MB doesn't seem... all that big though? 🙄
I just pushed a 90MB video to the nextflow repo in a single commit 😅
cool cowboy 1
j
For 6 TSV tables a couple of images and a few scripts. For what we want to use it for it takes longer to download than I want to
👍🏻 1
e
seems intimidating.
It's just to scare the kids straight. Stay in school and don't rewrite git history
😆 2
m
I've used https://rtyley.github.io/bfg-repo-cleaner/ multiple times and I'm very happy with it. The main problem is indeed with collaborators. Maybe just ask them to clone the repo again after you've rewritten history.
j
Is that different from the
bfg
thing above?
m
Prob not 😄
👍 1