So here's what's happened:
git reset --soft HEAD~2
to get back to a commit before the accidentI assumed the git reset would revers everything from the accidental commit, but after checking bitbucket's list of git lfs files, it seems all the lfs tracked files from the accidental commit were pushed to lfs in origin. These files do not exist if I look through the source in bitbucket.
So I tried doing git lfs prune
which appeared to delete an amount of files that looks to be about the amount that was accidentally commited, then git lfs push origin master
. Checked bitbucket's list of git lfs files again, but those files are still there and nothing's changed in origin.
What have I done wrong?
There doesn't appear to be a standard way of doing this:
The Git LFS command-line client doesn't support pruning files from the server, so how you delete them depends on your hosting provider.
Bitbucket allows you to delete LFS files using its web UI (please read the entire linked page before proceeding):
Delete individual LFS files from your repository
It's important to understand that:
- The delete operation described here is destructive – there's no way to recover the LFS files referenced by the deleted LFS pointer files (it's not like the git remove command!) – so you'll want to back up the LFS files first.
- Deleting an LFS file only deletes it from the remote storage. All reference pointers stored in your Git repo will remain.
- No branch, tag or revision will be able to reference the LFS files in future. If you attempt to check out a branch, tag or revision that includes a pointer file referencing a deleted LFS file, you'll get a download error and the check out will fail.
A repository admin can delete Git LFS files from a repo as follows:
- Go to the Settings page for the repo and click Git LFS to view the list of all LFS files in that repo.
- Delete the LFS files using the actions menu.
Surprisingly, the only way to remove LFS files from GitHub appears to be to delete and recreate the repository, losing issues, stars, forks, and possibly other data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With