@dana
To remove big files from old commits in Bitbucket, you can use the following steps:
- Identify the commits that contain the big files you want to remove. You can use the following command in your terminal to list all the commits in your repository:
- Once you have identified the commits that contain the big files, you can use the following command to create a new branch from the commit before the first commit that contains the big files:
1
|
git checkout -b new_branch_name commit_sha
|
- Next, use the following command to remove the big files from the new branch:
1
|
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch path_to_big_file' --prune-empty --tag-name-filter cat -- --all
|
Replace "path_to_big_file" with the path to the big file you want to remove.
- Once the big files are removed from the new branch, you can force push the changes to the remote repository:
1
|
git push origin new_branch_name --force
|
- Finally, you can merge the changes from the new branch into your main branch or any other branch as needed:
1
2
|
git checkout main
git merge new_branch_name
|
These steps will allow you to remove big files from old commits in Bitbucket. Remember to back up your repository before making any significant changes.