Forums

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

Question about Git LFS after moving files with BFG — and cleanup request

cpedersen April 26, 2025

Hi support,

I have just used BFG Repo-Cleaner to move several large files to Git LFS and pushed the changes.
However, when I check the Git LFS section of the repository settings on Bitbucket, I don't see any files listed there.

Should I be able to see the moved files in the Git LFS section?
If something went wrong, I would like to revert the push before asking for a cleanup.

Here is the result from running git count-objects -Hv after the push:

count: 0

size: 0 bytes

in-pack: 144812

packs: 1

size-pack: 1.36 GiB

prune-packable: 0

garbage: 0

size-garbage: 0 bytes

Looking forward to your reply!


Best,
Camilla

1 answer

0 votes
cpedersen April 26, 2025

Here is my commands:

My commands:

brew install git-lfs

 git clone --mirror https://myuser@bitbucket.org/myuser/myrepo.git

 java -jar bfg-1.15.0.jar --convert-to-git-lfs “{MyBigFiles}” --no-blob-protection myrepo.git

 cd myrepo.git

git gc

git reflog expire --expire=now --all && git gc --prune=now --aggressive

git count-objects -Hv

git push

 

I realize now that I should have called git lfs install as well. Hope you can do a revert. I haven't pushed anything since that last push.

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2025

Hi @cpedersen

Thank you for reaching out to the community.

Have you tried doing git push with the --force flag instead?

You can refer to our documentation here for more information: Use BFG to migrate a repo to Git LFS

Unfortunately, it is not possible for us to revert any commits on our end, however, you could do that on your end by reverting it locally and pushing your local copy using the git push --force command.

Alternatively, if you have a backup your repository locally, you can also force push that.

Regards,
Mark C

cpedersen April 29, 2025

Hi @Mark C  ,

Thank you for your reply.

I’ve read the documentation many times and tried using BFG to move the files to Git LFS. But after pushing, I don’t see the files listed in the Git LFS section of the Bitbucket repo. You can see all my commands above.


Could you please tell me exactly which Git commands I should run to revert the push or fix the issue properly? I’d really appreciate a step-by-step guide, as I want to avoid making things worse.


I still have the local repository from before using BFG, but not a copy of the mirrored repository.


Looking forward to your reply.

Best,

Camilla

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 30, 2025

Hi @cpedersen

You can check this documentation on how to undo changes in Git using Bitbucket Cloud. - https://www.atlassian.com/git/tutorials/learn-undoing-changes-with-bitbucket

I'd also highly recommend taking a backup of your repository by copying your local repository and cloning your remote repository via --mirror clone just to make sure you have backup alternatives.

Here's the command:

git clone --mirror <repository URL>

Regards,
Mark C

Suggest an answer

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

Atlassian Community Events