public
Created

Sync the ~/git/ocaml.git repository with the master Subversion repository at Inria and upload the changes to GitHub at bmeurer/ocaml.

  • Download Gist
ocaml-git-sync.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/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/*'

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.