Forums

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

Regarding maintaining the PR's commit hashes after rewriting using BFG Repo cleaner

Saravanan Doraiswamy
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!
November 7, 2025

Hi Team,

Kindly note that, we have a Bitbucket repository with a long time history (~11 years) and long back there was a large file that was commited, pushed and later discovered and deleted. 

When we tried to migrate to GitHub, we found this because the history still had the large file and cleaned up using the BFG repo Cleaner. However, based on the documentations and discussions, we find that the rewrite will generate new commit ids and will make all the related old PR's references invalid because the commits are newly generated.

We also find that there is a file called as `object-id-map.old-new.txt` which was generated by the repo cleaner, will it possible for us to restore the commit and PR mapping so that we can preserve the PR and migrate to GitHub.

 

Your suggestions or help will be very useful for us. Kindly advise.

Regards,

Saravanan D

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 9, 2025

Hi @Saravanan Doraiswamy

Welcome to the community.

Indeed, that is the default behaviour of the BFG tool when re-writing Git history, although the old commit hash will still be recorded in the original commit.

For example, the re-written commit's message will be altered with a comment that says "Former-id".

Unfortunately, there's no specific way to restore the old commit after the rewrite other than restoring from an old copy of the repository.
I'd also suggest raising this with the BFG tool maintainer so that they're aware. - https://github.com/rtyley/bfg-repo-cleaner/issues

Regards,
Mark C

Saravanan Doraiswamy
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!
November 13, 2025

Thanks a lot for your response Mark.

We have few repositories that are facing this challenge and in some cases there were large files which were eventually deleted and we are stuck with the references in the history and cleanup and rewrite is the only option we had.

Kindly correct me if my understanding is not right, this operation has to be done to fix the history and post which all the new PR's will be fine and historical PR's are going to be with the missing refs.

Also, when we are trying to push after rewrites, we are getting the message that the bitbucket's internal PR's cannot be pushed, can you please let us know if we need to skip those refs and push the remaining and if you can link any documentation or post response for this it will be very helpful for us.

Thanks and Regards,

Saravanan D

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events