Skip to content

Instantly share code, notes, and snippets.

@donthorp
Created June 14, 2012 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save donthorp/2932494 to your computer and use it in GitHub Desktop.
Save donthorp/2932494 to your computer and use it in GitHub Desktop.
Auto-track svn vendor branches in git
#! /bin/sh
# This script expects to be in the parent directory of your github projects
#
# in /etc/cron.hourly create a script that invokes this script for each repo
#
# sudo -u USER /home/USER/PROJECTS-ROOT/update-vendor-branch.sh PROJECT-DIR-1
# sudo -u USER /home/USER/PROJECTS-ROOT/update-vendor-branch.sh PROJECT-DIR-2
echo "Updating vendor repository: $1"
cd ~USER/PROJECTS-ROOT/$1
git clean -df
git fetch --all
git reset --hard
git pull
git checkout vendor
git svn fetch
git svn rebase
git diff --shortstat vendor origin/vendor
git push
git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment