Skip to content

Instantly share code, notes, and snippets.

@noahd1
Created July 22, 2012 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahd1/3157987 to your computer and use it in GitHub Desktop.
Save noahd1/3157987 to your computer and use it in GitHub Desktop.
local_ownership
#!/bin/sh
#/ Usage: transfer-master path-to-repo( path-to-repo( path-to-repo))...
#/ Changes master to reference new master
set -e
# show program usage
if [ $# -eq 0 -o "$1" = "--help" ]
then
grep '^#/' <"$0" |
cut -c4-
exit 2
fi
original_path=`pwd`
for repository_path in "$@"
do
cd $original_path
if test -d $repository_path && cd $repository_path && test `git config remote.origin.url | grep efficiency20`
then
new_repository_url=`git config remote.origin.url | sed 's/efficiency20/c3-e/'`
git remote rename origin old-origin
git remote add origin "$new_repository_url"
git fetch origin
git remote rm old-origin
git branch --set-upstream master origin/master
# git pull --rebase
else
echo "Skipping $repository_path because it is not an efficiency20 git repository."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment