Since my last push, my repo is above 2 GB and I followed this:
Create a temporary branch to keep any local commits.
Reset the original branch to the commit just before the bad commit containing the large files.
Push the new head to Bitbucket (rewriting history).
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 https://mathiagr@bitbucket.org/mathiagr/bitpet.git
To https://bitbucket.org/mathiagr/bitpet.git
! [rejected] Mathias -> Adding-portal-to-3D-and-AR-scene (non-fast-forward)
error: failed to push some refs to 'https://mathiagr@bitbucket.org/mathiagr/bitpet.git'
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?
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,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.