Pagine

Thursday 11 May 2017

How to migrate a branch in a new git repository

For a reason with almost zero probability but not impossible you may find yourself in the situation of having to migrate a single branch between two git repositories.
Follow these steps for migration:
 git clone <old_repo>
 git checkout <branch_target>
 git remote set-url origin <new_repository>
 git push origin <branch_target>
Now clean your workspace, clone the old repository and remove branch target.
See the previous post "How to delete local and remote branches with git" for more details about delete of a branch.

No comments:

Post a Comment