Skip to content

Instantly share code, notes, and snippets.

@fgalassi
Created August 23, 2012 16:16
Show Gist options
  • Save fgalassi/3438173 to your computer and use it in GitHub Desktop.
Save fgalassi/3438173 to your computer and use it in GitHub Desktop.
Update git-svn repository and externals
#!/bin/sh
root=`git rev-parse --show-toplevel`
echo "Moving to root: $root"
cd $root
echo "Rebasing current directory"
git svn rebase
echo "Looking for externals"
external=`git svn propget svn:externals`
if [ -z "$external" ]; then
echo "No external found."
exit 0
fi
dir=`echo $external | cut -d " " -f 1`
rev=`echo $external | cut -d " " -f 3`
url=`echo $external | cut -d " " -f 4`
echo "Found external repository:"
echo "Url: $url"
echo "Rev: $rev"
echo "Dir: $dir"
echo "Rebasing $dir"
cd $dir
git svn rebase
echo "Checking out right commit/revision"
commit=`git svn find-rev r$rev`
echo "Commit: $commit"
git checkout $commit
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment