Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to clean down a repo - reset completelty

simon July 4, 2025

Afternoon, I'm trying to find a way where by i purge all history/files/ref/tags etc form a bitbucket repo so that for all purpose it has nothing in ..
im using this snippet 

echo "Deleting existing refs (branches, tags, remotes)…";
git for-each-ref --format='%(refname)' | xargs -r -n 1 git update-ref -d;

echo "Creating empty root commit on main";
git symbolic-ref HEAD "refs/heads/main";
git commit --allow-empty -m "Initial empty commit after history reset";

echo "Running aggressive Git GC";
git reflog expire --expire=now --all;
git gc --aggressive --prune=now;
git push -u origin main --force;

this does fine at removing all the ref,files etc.. however when i look at the project reposostries view https://bitbucket.org/<user>/workspace/projects/<abc>
it shows the project to still have a size of 15mb i thought it should go back the the inital repo size of about 50kb
 

Is it even possible to do this with out a support call..

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events