younotesunreadstarredadd url

HowTo completely remove a file from Git history | MDLog:/sysadmin

http://www.ducea.com/2012/02/07/howto-completely-remove-a-file-from-git-history/

october 2012gitopen in karakeep

by Marius Ducea ‧ published 2012.02.07 ‧ saved copy from 2026.03.03

Karakeep has no AI summary for this page yet. summarize now

page description:

I just started working on a new project and as you would expect one of the first things I did was to download its git repository from github. These were just some scripts and should have been very small ~5M, but the clone from gitbhub took about one hour as the full repo folder was 1.5G… (with the biggest size under .git/objects/pack) Crazy… What was in the git repository history that would cause something like this? I assumed that at some point in time the repository was much bigger (probably from some file/s that don’t exist anymore), but how could I find out what were those files? And more important howto remove them from history? Well if you came here from a google search on “how to remove a file from git history” then you probably know there are plenty of docs and howtos on how to achieve this but from my experience none of them really worked. This is why I decided to document the steps needed to identify the file from the git repo history that is using all that space and to have it removed fully and bring the repository to a manageable size. First we need to identify the file that is causing this issue; and for this we will verify all the packed objects and look for the biggest ones: git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 (and grab the revisions with the biggest files). Then find the name of the files in those revisions: git rev-list --objects --all | grep <revision_id> Next, remove the file from all revisions: git filter-branch --index-filter ‘git rm --cached --ignore-unmatch <filename>’ rm -rf .git/refs/original/ Edit .git/packed-refs and remove/comment any external pack-refs. Without this the cleanup might not work. I my case I had refs/remotes/origin/master and some others branches. vim .git/packed-refs Finally repack and cleanup and remove those objects: git reflog expire --all --expire-unreachable=0 git repack -A -d git prune Hopefully these steps will help you completely remove those un-wanted files from your git history. Let me know if you have any problems after following these simple steps.
screenshot of the page

« back to bookmarks

top tags     all tags251020manage

*bookmark *download *tobuy *tofollow *toread *wishlist 2d 360 3d 3g abandonware accounting actionscript air airplay algorithm android animation api app apple appstore arcade arduino art article asm assembler audio automation baby backlight backup bbs berlin bitcoin bivert blipfm blipster blog blu-ray bluetooth book bookmark bootcamp boxee brasil brazil bruno bug bugtracking buildapc business c c# c++ carro casa cell chart chiptune cliq cocoa cocoa-touch code collection component controller cooking core-graphics crt css curso database ddwrt debug demoscene design deutschland dev developer development diy dj dns doc dos dosbox dotnet download dreamcast drink drm ds dvb-c dvd ebook electronics emu emudev emulator engine example facebook famicom feedbin firmware fix flash flashcart flex fluorine forum framework freeware gadget game gameboy gameboy-pocket gamedesign gamedev gamegear games gba genesis german germany git google googlemaps GoogleReader gps gsm gui guide hack hacks hamburg hardware home home-automation homeassistant homebrew honda howto html htpc http icon IFTTT ikea image imported indie inspiration install insteon interview ios ipad iphone iptv iso itunes jailbreak japan java javascript job keyboard lastfm lcd lib library linux live lldb localization london mac macos mame management mapkit mastersystem math mce media mediacenter megadrive memory-management miami midi mod movie mp3 mpd msn music mythtv nas nes network nvidia nyc objective-c opengl opengles opensource osx pc pcb perlerbeads php physics piracy plex plugin Pocket portfolio prepaid project ps1 ps2 ps3 ps4 psp puremvc push pvr python raspberrypi recalbox recipe region remote repro resource restaurante retrogaming retrograming retropc retropie rgb rip rom roms router ruby rubyonrails saopaulo scart scumm sdk security seedbox serial server shmups shop shopping sim sms snes software sonos sound soundblaster soundtrack source spotify sql sqlite star startup steamdeck store stream subtitles svn swift sync synology synth tax terminal three20 tips tool tools toread torrent tracker travel trip tutorial tweak twitter ubuntu ui uitableview unix unlock uremote usa veralite viagem video vista vita vpn vps vst walkthrough warez web2.0 webdesign webradio webservices wifi wii wiiu windows wishlist wordpress xbmc xbox xcode xml xna youtube z-wave z80 zigbee