Last active
August 29, 2015 14:05
-
-
Save jeremywadsack/32480ed8693b369416b7 to your computer and use it in GitHub Desktop.
Change git remote after renaming origin organization at GitHub
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
# A one-line script to change the origin organization name. | |
# | |
# After renaming our organization at GitHub, I had 25 repos I needed to update locally. | |
# This script finds the current "origin", removes it and replaces it with a new one | |
# with the organization changed. | |
# | |
# Just change OLD_ORG and NEW_ORG below to the old and new organization names and run | |
# this in each repository. | |
f=`git remote -v | grep '^origin' | cut -c 8- | cut -d' ' -f 1 | uniq`; git remote remove origin; git remote add origin ${f/OLD_ORG/NEW_ORG} | |
# You should also, then update your remotes. | |
git remote update --prune |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment