Skip to content

Instantly share code, notes, and snippets.

@orimanabu
Created August 7, 2012 08:27
Show Gist options
  • Save orimanabu/3283179 to your computer and use it in GitHub Desktop.
Save orimanabu/3283179 to your computer and use it in GitHub Desktop.
postgres repo sync script among mainline and local and personal github
#!/bin/sh
current_branch=$(git branch | grep '^\*' | sed -e 's/^\* //')
echo "==> checking current branch: ${current_branch}"
if [ x"${current_branch}" != x"master" ]; then
echo "current branch is not 'master'."
echo "===> checking out master..."
git checkout master
if [ x"$?" != x"0" ]; then
echo "checking out master failed."
echo "exit."
exit 1
fi
fi
echo "==> pulling from github original repo..."
git pull git@github.com:postgres/postgres.git master
echo "==> pushing to github personal repo..."
git push
echo "==> finish: changing back to working branch: ${current_branch}"
git checkout ${current_branch}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment