Last active
May 5, 2018 11:48
-
-
Save rvillablanca/b69432acb96c043f727d761551e221d2 to your computer and use it in GitHub Desktop.
Push to another remote repository
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
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "no remote name" | |
exit -1 | |
fi | |
if [ -z "$2" ] | |
then | |
echo "no remote url" | |
exit -1 | |
fi | |
git fetch --all -v --prune | |
git remote add $1 $2 | |
git push $1 master | |
git push $1 'refs/remotes/origin/*:refs/heads/*' | |
git push $1 :HEAD | |
echo "Pushed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment