Last active
September 24, 2018 23:05
-
-
Save maxime-rainville/0e2cc280cc9d2e014a21b55a192076d9 to your computer and use it in GitHub Desktop.
Simple script for renaming the origin remote to silverstripe and adding an open-sausages/cc remote.
This file contains hidden or 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 | |
# Define a few constant | |
ss_account="[email protected]:silverstripe/" | |
ss_http_account="https://github.com/silverstripe/" | |
os_account="[email protected]:open-sausages/" | |
cc_account="[email protected]:creative-commoners/" | |
# Get our url for our origin remote | |
origin_url=`git remote get-url origin` | |
# If it matches our primary ss account | |
if [[ $origin_url == "$ss_account"* ]] | |
then | |
git remote rename origin silverstripe | |
git remote add os ${origin_url/$ss_account/$os_account} | |
git remote add cc ${origin_url/$ss_account/$cc_account} | |
git fetch --all | |
elif [[ $origin_url == "$ss_http_account"* ]] | |
then | |
git remote rename origin silverstripe | |
git remote add os ${origin_url/$ss_http_account/$os_account} | |
git remote add cc ${origin_url/$ss_http_account/$cc_account} | |
git fetch --all | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment