Created
August 21, 2017 14:50
-
-
Save janwirth/e21fa2a8b0733ad7803e3694afe35874 to your computer and use it in GitHub Desktop.
Sync git to svn - commit history will NOT be kept. One way sync only.
This file contains hidden or 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/sh | |
SVN_REPO=mydomain.com/svn-repo/trunk | |
GIT_REPO=SVN_REPO=mydomain.com/git-repo.git | |
# CLONE GIT | |
rm -rf git-downstream | |
git clone $GIT_REPO git-downstream --depth=1 | |
# CLONE SVN | |
rm -rf svn-upstream | |
git svn clone $SVN_REPO svn-upstream | |
# CREATE PATCH FROM DIFF BETWEEN REPOS | |
diff -urN svn-upstream git-downstream -x .git -x .svn > sync.patch | |
cat sync.patch | |
# APPLY PATCH | |
cd svn-upstream | |
git apply ../sync.patch | |
git add . | |
git commit -m "git to svn sync" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment