Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing Big, old Files that do not belong in git [duplicate]

Tags:

git

Long story short, there are very big files (like iso files-big) that were pushed into git. Not during my time with the group, but they've been treating the repo like an SVN-VC.

Anywho, how can i removed iso's from the repo and its history, to lighten the repo.

Or

Would it be easier to just move the code to a new repo, losing it's repo?

like image 328
Baconbitz Avatar asked Dec 01 '25 20:12

Baconbitz


2 Answers

Long story short, there are very big files (like iso files-big) that were pushed into git

You should use this tool to clean your repository history:

https://rtyley.github.io/bfg-repo-cleaner/

It is the perfect tool for this kind of task

BFG Repo-Cleaner

an alternative to git-filter-branch.

The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history:

  • Removing Crazy Big Files
  • Removing Passwords, Credentials & other Private data

Examples (from the official site)

In all these examples bfg is an alias for java -jar bfg.jar.

# Delete all files named 'id_rsa' or 'id_dsa' :
bfg --delete-files id_{dsa,rsa}  my-repo.git

enter image description here


After you have cleaned your repository use this tool to store your large files.

enter image description here

like image 131
CodeWizard Avatar answered Dec 04 '25 16:12

CodeWizard


Look at git filter branch and BFG repo cleaner, which was made precisely for this task. Beware that both of these tools rewrite history, which is a dangerous operation. Make sure you know what you are doing, and make backups before you do.

like image 22
Matthieu Moy Avatar answered Dec 04 '25 18:12

Matthieu Moy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!