Our git repository is around 2GB and when cloned accounts for around 3GB due to the checkout in the workspace. I know there are a couple of very large binaries that may have been deleted form version control in the past but still exist in the repository.
Is there a way using either SourceTree or Stash to identify and/or delete these files?
Hmmmm ... as those files are part of the history of your project they shold not be removed from the repository - doing so you won't be able to checkout a complete historical version of your software (as the files you removed finally are not part of the repository anymore).
Usually removing files from the repository is only done when those files were added by accident and you are completly sure you don't need them - even in historical versions of your software. If you say, "I don't need the files anymore" this involves you needed the files earlier - and therefore the files should not be removed (as you cannot reconstruct them)
Removing files from the repository is a git task - and therefore not part of stash. Sourcetree does not offer this as well - you have to do this on comand-line using the command
git filter-branch --tree-filter ....
as for example described here.
The best way to do this, is cloning your repository from stash and performing the git-filter action on your local clone. After approval that your local repository looks fine, you should remove the "huge" repository from STASH and re-push the modified repository. After this you have to be sure that all of your coworkers remove their old local copies of the repository and clone the modified one!
If your main concern is the size of the repository to clone (2-3GB) you should consider to do a shallow clone (as for example described here). A shallow clone allows you to clone a repository keeping only the latest n commits of history. Therefore you can omitt those large historical files from cloning - with the drawback not to have the complete history of your project locally available.
Yes, the large files I would like to delete were added accidentally and are not being used at all. Thanks you for the link that explains how to go about with removing the files.
Shallow clones may not be for us as it has some limitations about committing changes to that type of clone.
Happy Friday – Fun Day! I don’t know about you, but I have been giving everything I’ve got this week (and most weeks) and come Friday I look for unique ways to recharge my batteries - rest, relax, a...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG