For example, we need to migrate the Github (old) repository to Bitbucket (new) repository and we need to keep both of them for a while.
To do it we need to make the next steps
- Git clone Bitbucket (new) repository
git clone git@bitbucket.org/example.git
- Add origin2 to Github (old) for the repository cloned from Bitbucket (new)
git remote add origin2 git@github.com/example.git
- Push
develop-new
Bitbucket (new) branch to Github (old)
git push origin2 develop-new:develop-new
- Clone Github (old) repository
git clone git@github.com/example.git
- Identify changes in Github (old), applied later than captured date
git log develop
git log develop-new
- Cherry-pick appropriate change-sets from
develop
intodevelop-new
in GitHub
git switch develop-new
git cherry-pick ...
- Push appropriate changes in
develop-saferent
in GitHub
git push
- Fully clone and rewrite Bitbucket (new) repository by GitHub (old) repo, sample
git clone --bare git@github.com/example.git
git push --mirror git@bitbucket.org/example.git
- Remove the directory with the bare repository.
rm -rf example.git