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 [email protected]/example.git- Add origin2 to Github (old) for the repository cloned from Bitbucket (new)
git remote add origin2 [email protected]/example.git- Push
develop-newBitbucket (new) branch to Github (old)
git push origin2 develop-new:develop-new- Clone Github (old) repository
git clone [email protected]/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
developintodevelop-newin GitHub
git switch develop-new
git cherry-pick ...- Push appropriate changes in
develop-saferentin GitHub
git push- Fully clone and rewrite Bitbucket (new) repository by GitHub (old) repo, sample
git clone --bare [email protected]/example.git
git push --mirror [email protected]/example.git- Remove the directory with the bare repository.
rm -rf example.git