Skip to content

Instantly share code, notes, and snippets.

@skseth
Forked from proger/gist:1877247
Created September 29, 2018 18:33
Show Gist options
  • Save skseth/477d46a0bf835692a35979ccaaa3a785 to your computer and use it in GitHub Desktop.
Save skseth/477d46a0bf835692a35979ccaaa3a785 to your computer and use it in GitHub Desktop.
oneway git->svn sync
#!/bin/bash
SVN_HOST="https://svn/path/to/repo"
git checkout master
git pull --rebase
git config --local svn-remote.svn.url "${SVN_HOST}"
git config --local svn-remote.svn.fetch ":refs/remotes/git-svn"
git config --local svn.rmdir true
git svn fetch
git reset --hard HEAD
git branch -D temp-svn
git checkout -b temp-svn remotes/git-svn
git merge --log --stat -X theirs master
git checkout master -- . # resolve unmerged paths
[ -f .git/MERGE_MSG ] && git commit -F .git/MERGE_MSG
git svn dcommit && git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment