Created
January 13, 2023 11:22
-
-
Save pentago/8ba78c3289e3e7640b886f1cc4e6f5d8 to your computer and use it in GitHub Desktop.
Bitbucket to Github repo migration shell function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bitbucket to Github Migration | |
bb2gh() { | |
echo "Cloning repo" | |
git clone $1 $2 | |
echo | |
echo "Entering repo directory" | |
cd $2 | |
echo | |
echo "Adding remote" | |
git remote add upstream $3 | |
echo | |
echo "Fetching all remote branches" | |
for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done | |
echo | |
echo "Pushing" | |
git push --all upstream | |
git push --tags upstream | |
echo | |
echo "Setting Origin URL" | |
git remote set-url origin $3 | |
echo | |
echo "Mirroring" | |
git push --mirror | |
cd .. | |
echo "Complete" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment