9/12/2023 0 Comments Git undo commit file too big![]() you can turn it off by adding - no-blob-protection, you can read more on their website.Ĭd to your repository then run this shell one-liner in Terminal git rev-list -objects -all | git cat-file -batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort -numeric-sort -key=2 | cut -c 1-12,41- | $(command -v gnumfmt || echo numfmt) -field=2 -to=iec-i -suffix=B -padding=7 -round=nearest By default, the BFG doesn’t modify the contents of your latest commit on your master (or ‘ HEAD’) branch, even though it will clean all the commits before it.so I will delete it, then commit the changes then we can remove them from the Git History, because: You need to remove any unwanted files from your current directory, for example, I know that I don’t want the “Pods” folder because it just contains 3rd party libraries that I can install easily after cloning the project. It can delete folders using their names. for example, delete all folders named “SomeFolder”ģ- Delete unwanted files from your project because your current files are sacred.It can delete files using their names. for example, delete all files named ‘id_rsa’ or ‘id_dsa’.It can delete all the files and folders that are bigger than a certain size. for example, remove all blobs bigger than 50 megabytes:.brew install bfgĪs you can see It’s already installed on my machine: I suggest installing it via homebrew for Mac OS Users using this command in the terminal, otherwise, you can check out their website and download it directly. In order to make an exact duplicate, you need to perform both a bare-clone and a mirror-push: mkdir foo cd fooĢ- install BFG Cleaner, it‘s a useful tool for cleaning git repository from unwanted files. 1- Duplicate your project so you won’t have the risk of losing some important files. ![]() Here are the steps that I took to shrink its size down to 10.7 MB on my OSX machine. Years ago I didn’t know much about the “ gitignore” concept and how I can prevent uploading unnecessary files to git, so that’s why some of my oldest projects are more than 700 MB while they should actually be less than 30 MB.Ībout a month ago I decided to work on one of those old repositories with a huge size of 749.6 MB I recently reduced the Git repository size from 749.6 MB to 10.7 MB for one of my old projects, and I’m gonna demonstrate how you can do the same, I did it for my iOS Application project but the following steps should work for any project that uses Git version control because we’re only dealing with Git, to be more specific. This article has been written by me on March 25 on, here is the link if you prefer to read it there. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |