I examined a insert of data files in to a branch and merged and after that had to remove them and today I'm left with a large.pack document that I put on't know how to obtain rid of.
Jun 17, 2012 - Find a Ewhore pack like so: im doing ( Either cam shows or selling a large amount of pictures.
I deleted all the documents making use of
git rm -rf xxxxxx
and I also ran the-cached
choice as well.Can someone inform me how I can remove a large.pack document that will be currently in the following directory site:
.git/objects/pack/pack-xxxxxxxxxxxxxxxxx.pack
Perform I simply need to remove the department that I still have but are no more using? Or is usually right now there something else I need to operate?
I'm not sure how much difference it makes but it displays a padlock against the document.
Thanks a lot
EDIT
Right here are some excerpts from my bashhistory that should provide an concept how I managed to obtain into this state (presume at this point I'meters operating on a git branch known as 'my-branch' and I've got a folder comprising more folders/files):
I believed I furthermore ran the using but it doesn't appear in the bashhistory with the others :
I furthermore thought I ran some git instructions (like
git gc
) to consider to tidy up the pack file but they put on't show up in the.bashhistory document either.user1116573consumer1116573
8322 platinum badges9 silver precious metal badges25 bronze badges
6 Solutions
The issue is usually that, even though you removed the documents, they are still existing in previous changes. That's the entire stage of git, is certainly that even if you delete something, you can still obtain it back again by being able to view the history.
What you are usually searching to do is called rewriting background, and it involved the
git filter-branch
order.GitHub has a great explanation of the concern on their site. https://help.github.com/articles/remove-sensitive-data
To remedy your query more directly, what you generally require to operate will be this control with
unwantedfolenameorfolder
replaced accordingly:This will eliminate all referrals to the data files from the energetic history of the repo.
Next, to peform a GC period to push all referrals to the document to be ended and cleared from the packfile. Nothing at all needs to end up being changed in these instructions.
Brondahl2,2491 money badge18 magic badges30 bronze badges
loganfsmythloganfsmyth109k21 gold badges238 metallic badges196 bronze badges
One option:
run
git gc
personally to condense a amount of pack data files into one or a few pack documents. This procedure is prolonged (i actually.age. the large pack document will maintain its data compresion behaviour) so it may become advantageous to reduce a repository periodically withgit gc -intense
Another option is certainly to conserve the program code and.git somewhere and then remove the.git and begin again using this existing code, developing a fresh git repository (
Jordan DurrantMeters Durrantgit init
).60.8k68 money badges249 metallic badges374 bronze badges
Situation A: If your large documents were just included to a part, you don't want to operate
git filter-branch
. You just require to delete the department and run garbage collection:Scenario T: Nevertheless, it appears like based on your party history, that you do combine the changes into get better at. If you haven't distributed the adjustments with anyone (no
git press
however). The least difficult issue would end up being to reset master back to before the merge with the part that got the big documents. This will get rid of all commits from your branch and all commits produced to get good at after the merge. So you might eliminate modifications - in inclusion to the huge data files - that you may have actually needed:Then operate the tips from the situation A new.
Situation M: If there had been other changes from the partorchanges on expert after the merge that you would like to keep, it would be very best to rebase get good at and selectively include commits that you would like:
In your publisher, remove outlines that correspond to the commits that added the large documents, but keep everything else as is. Conserve and stop. Your get better at branch should only contain what you would like, and no large files. Notice that
git rebase
without-g
will eliminate merge commits, therefore you'll be still left with a linear history for expert afterlt;commit hashgt;
. This is probably okay for you, but if not, you could try out with-g
, butgit assist rebase
sayscombining -p with the -we option explicitly is usually not a great idea unless you know what you are usually performing
.After that operate the commands from scenario A new.
onlynoneonlynone4,6773 money badges21 sterling silver badges41 bronze badges
As loganfsmyth currently stated in his response, you need to free git background because the files carry on to can be found there also after removing them from the repo. Formal GitHub docs suggest BFG which I find less complicated to use than
filter-branch
:Deleting files from history
Download BFG from their site. Make certain you have java set up, then develop a hand mirror clone and free history. Make sure to change
YOURFILENAME
with the name of the document you'd like to delete:Delete a folder
Same as above but make use of
-delete-folders
Various other choices
BFG furthermore enables for also fancier choices (discover documents) like these:
Remove all data files larger than 100M from history:
Important!
When operating BFG, become cautious that both
TimoTimoYOURFILENAME
andYOURFOLDERNAME
are usually indeed just document/folder titles.They're not really paths, so something likefoo/club.jpg
will not really work! Instead all files/folders with the stipulated title will be eliminated from repo background, no matter which route or branch they been around.7,27915 money badges81 silver precious metal badges135 bronze badges
I have always been a little late for the present but in case the above answer didn't solve the concern after that I found another way. Simply remove the particular large document from.pack. I experienced this issue where I examined in a large 2GM file accidentally. I followed the tips explained in this link: http://www.ducea.com/2012/02/07/howto-completely-remove-a-file-from-git-history/
Rishabh KumarRishabh Kumar
this can be even more of a convenient answer than a code one. zip the document. Open the zip in document see format (various from unzipping). Delete the.pack file. Unzip and replace the folder. Works like a appeal!
shreya10shreya10