How to Migrate Git Repository with Branches and Commit History

Zeeshan Baig
Oct 10, 2018 · 2 min read
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.

DataNext Solutions

Cloud | Security | DevOps | Big Data

Zeeshan Baig

Written by

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

DataNext Solutions

DataNext Solutions is a US based system integrator, specialized in Cloud, Big Data, DevOps technologies. As a registered AWS partner, our services comprise any Cloud Migration, Cost optimization, Integration, Security and Managed Services.

Zeeshan Baig

Written by

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

DataNext Solutions

DataNext Solutions is a US based system integrator, specialized in Cloud, Big Data, DevOps technologies. As a registered AWS partner, our services comprise any Cloud Migration, Cost optimization, Integration, Security and Managed Services.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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