Syncing github with bitbucket – with commit History

In modern development pipelines, it’s common for teams to use multiple Git hosting platforms based on organizational needs. In this scenario, a project was initially deployed using GitHub, but due to new team workflows or client preferences, Bitbucket is now required to host the same code — with full commit history and continuous synchronization to support automated deployments.

Migrate an existing GitHub repository to Bitbucket

Retain the full commit history

Keep both repositories synchronized to support CI/CD pipelines

git clone git@github.com:/<github_repo_name>.git
cd <github_repo_name>

Rename the default origin remote (which points to GitHub) to github for clarity.

git remote rename origin github

git remote add bit <bitbucket_repo_url>

Pull all references and commit info from Bitbucket:

git fetch bit

Check out the branch from Bitbucket you want to merge into

git checkout bit/<branch_name>

Now merge GitHub’s branch into Bitbucket’s branch. Since these are unrelated histories, use the --allow-unrelated-histories flag

git merge –allow-unrelated-histories github/<branch_name>

If you encounter any conflicts, Git will notify you. Manually resolve them, then add and commit

git add .
git commit -m “Resolved merge conflicts between GitHub and Bitbucket histories”

For more insights and professional Odoo Community/Enterprise implementations, connect with us at hashcodeit.com or drop an email at info@hashcodeit.com.  Transform your Odoo journey with precision and expertise!

Leave a Comment