Last active
December 10, 2015 21:38
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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