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

Cleanup of Unreferenced Files in Git LFS

Anton Liashkevich
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 19, 2024

Hello everyone,

I'm facing an issue with Git LFS and would appreciate some guidance. I have a Git LFS repository where I've been working on a branch that involved several commits, each modifying a binary file. This resulted in multiple versions of the file being stored in LFS. Before merging this branch into main, I squash the commits to maintain a clean history and, more importantly, to reduce the LFS storage usage.

However, I've noticed that even after squashing, the unreferenced file versions are not automatically deleted, which still consumes LFS space.

Is there a way to automate the cleanup of these unreferenced files rather than having to do it manually? Perhaps through a post-merge hook or another method?

Thanks in advance for your help!

1 answer

1 accepted

0 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 21, 2024

G'day, @Anton Liashkevich 

Welcome to the community.

I believe there's a way to delete the LFS via a script you can check them out at:

Delete LFS script

You'll have to get the list of LFS OID and save it as oids.txt and the script will use them to delete the LFS files.

Regards,
Syahrul

Anton Liashkevich
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 22, 2024

Thank you!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events