How to Migrate Git Repository with Branches and Commit History

Image for post
Image for post
www.datanextsolutions.com

Overview

A short and useful post today, recently we had a customer requirement to migrate their git repositories from one account to another service provider, for example moving from bitbucket to GitHub, the repositories had a history of branches and commit for over 5 years and were quite huge in size.

The solution was quite simple but I thought to document this for anyone who is looking to solve a similar problem.

Solution

Step 1 is to mirror the Git repository to your local machine by the following command

The above command would create a directory with your repository name.git format for example myproject.git

Step 2 is to create a new repository on the destination server with the same name (not required though)

Step 3 is set the remote repository URL, run the command from inside your git repo folder

Step 4 is to push the repository to the destination

By running the following commands you can migrate the complete Git repository with all Commit history and Branches.

Hope you find this post useful, please leave a comment for any questions or suggestions.

@IamZeeshanBaig

About DataNext

DataNext Solutions is a US based system integrator, specialized in Cloud, Big Data, DevOps technologies. As a registered AWS partner, our services comprise of any Cloud Migration, Cost optimization, Integration, Security and Managed Services. Click here and Book Free assessment call with our experts today or visit our website www.datanextsolutions.com for more info.

Originally published at datanextsolutions.com on October 10, 2018.

Written by

Cloud Security Expert & CEO of DataNext Solutions, helping people every day with the latest tech. Connect @LinkedIn http://bit.ly/zb-linkedin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store