Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SourceTree: Obliterating large files from a Git repository

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?

1 answer

1 accepted

0 votes
Answer accepted

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.

Thanks Johannes.

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in DevOps

Step up your DevOps game webinar Q&A series - Questions answered!

  On October 21st, 2020 we hosted a webinar titled,   Step Up You DevOps Game with 4 Key Integrations for Jira and Bitbucket. We had a great showing and high engagement, but that meant th...

120 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you