Skip to content

Instantly share code, notes, and snippets.

@bilke
Created December 20, 2011 10:40
Show Gist options
  • Save bilke/1501146 to your computer and use it in GitHub Desktop.
Save bilke/1501146 to your computer and use it in GitHub Desktop.
Git to/from SVN sync on vismac02 Gitorious (cron jobs)
#!/bin/bash
cd ~/repos > /dev/null 2>&1
cd ogs_sources_svn > /dev/null 2>&1
REBASE_OUTPUT=`git svn rebase` > /dev/null 2>&1
if [ "$REBASE_OUTPUT" != 'is up to date' ]; then
exit 0
fi
cd ../ogs_sources > /dev/null 2>&1
git checkout master > /dev/null 2>&1
PULL_OUTPUT=`git pull svn master` > /dev/null 2>&1
git push origin master > /dev/null 2>&1
cd .. > /dev/null 2>&1
if [ "$PULL_OUTPUT" != 'Already up-to-date.' ]; then
echo "Synced with subversion:"
echo "$PULL_OUTPUT"
fi
#!/bin/bash
cd /home/bilke/repos > /dev/null 2>&1
cd ogs_sources > /dev/null 2>&1
git checkout master > /dev/null 2>&1
git pull origin master > /dev/null 2>&1
cd ../ogs_sources_svn > /dev/null 2>&1
git fetch child > /dev/null 2>&1
git merge --squash --no-commit child/master > /dev/null 2>&1
STATUS=`git status`
if [[ ! $STATUS =~ "working directory clean" ]]
then
git commit -m "Squashed commit."
git svn dcommit
fi
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment