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

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

Cannot reduce repository size

Since my last push, my repo is above 2 GB and I followed this:


  1. Create a temporary branch to keep any local commits.

  2. Reset the original branch to the commit just before the bad commit containing the large files.

  3. Push the new head to Bitbucket (rewriting history).

  4. Restore local changes – you won’t be able to push these yet, you’ll need to remove any large files first.


I did step 1 and 2, but when I try step 3 I get:


Pushing to


! [rejected]          Mathias -> Adding-portal-to-3D-and-AR-scene (non-fast-forward)

error: failed to push some refs to ''

hint: Updates were rejected because a pushed branch tip is behind its remote

hint: counterpart. Check out this branch and integrate the remote changes

hint: (e.g. 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.



How come I cannot complete step 3 with errors?


1 answer

0 votes

Hi Mathias,

Based on the output that you attached here, it looks that you might have attempted to push without the --force flag. When you do a reset operation locally and then try to push without the --force flag, you will get an error because the remote branch contains commits that the local one doesn't (the commits you reset). In this case, it is only possible to push the branch with the --force flag.

Please keep in mind that the --force flag will force the remote branch to get your local version of the branch. If anyone else has pushed additional commits to this branch that you don't have locally, those will be lost.

I can see in our system that the repo referenced in the output is now below 2 GB, so I assume that you managed to perform the operation and reduce the repo's size?

If you'd like, I can run a git gc on the remote repo to remove any dangling commits, which may further reduce the repo's size, just let me know.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

121 views 0 2
Join discussion

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