Skip to content

Instantly share code, notes, and snippets.

@atimb
Last active December 10, 2015 21:38
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 atimb/4496371 to your computer and use it in GitHub Desktop.
Save atimb/4496371 to your computer and use it in GitHub Desktop.
Bash script to sync the contents of a GIT repo to an SVN one.
#!/bin/bash
##
# Bash script to sync the contents of a GIT repo to an SVN one.
# Created because the git-svn method has its problems (only manually resolvable conflicts during rebase)
# This is just a plain content-overwrite, and proper removal of emptied directories
##
GIT_REPO_PATH=/define/me
SVN_REPO_PATH=/define/me
cd /
rsync -av --delete --exclude ".git" --exclude ".svn" $GIT_REPO_PATH $SVN_REPO_PATH
cd $SVN_REPO_PATH
# Ruby script can be found at https://gist.github.com/4496313
ruby find-empty-dir-in-svn.rb | xargs svn del
svn st | grep ^? | awk '{ print $2 }' | xargs svn add
svn st | grep ^! | awk '{ print $2 }' | xargs svn del
svn ci -m "Sync with git repo"
svn up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment