Skip to content

Instantly share code, notes, and snippets.

@bmeurer
Created August 18, 2011 14:17
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 bmeurer/1154143 to your computer and use it in GitHub Desktop.
Save bmeurer/1154143 to your computer and use it in GitHub Desktop.
Sync the ~/git/ocaml.git repository with the master Subversion repository at Inria and upload the changes to GitHub at bmeurer/ocaml.
#!/bin/sh
# ~/bin/ocaml-git-sync.sh: Sync the ~/git/ocaml.git repository with the master
# Subversion repository at Inria and upload the changes
# to GitHub at bmeurer/ocaml.
# Copyright (c) 2011 Benedikt Meurer <benedikt.meurer@googlemail.com>
#
# Repository location
GIT_DIR="$HOME/git/ocaml.git"
export GIT_DIR
# Update with latest changes from Subversion
git --bare svn fetch --all --no-checkout --quiet || exit $?
# Update local tracking branches
for branch in `git --bare branch -r | grep -v github`; do
git --bare branch -f -t "$branch" "remotes/$branch" > /dev/null
done
# Minify!
git --bare repack -A -d -q || exit $?
git --bare gc -q || exit $?
# Push to GitHub
git --bare push -q github 'refs/heads/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment