Short tip: Migrate Git repository with history

Recently, I had to migrate a bigger amount of git repositories from one software to another provider. One requirement was to copy the whole project including commit history and tags. Fortunately, it was easy to automate this process.

First of all the former repository needs to be cloned - if not done, yet:

1$ git clone <URL>

Created tags are read like this:

1$ git fetch --tags

If you leverage multiple branches, check-out all branches that need to be copied once:

1$ git checkout <branch>

Afterwards, remove the remote server and add the new server:

1$ git remote rm origin
2$ git remote add orgin <URL>

Tags and commit history is copied with these two commands:

1$ git push --tags
2$ git push origin --all

Translations: