Something that I did create over some years – there is nothing similar that I have found as a open/OSS solution, so therefore I’d like to share it.
#!/bin/bash if [ -f ~/tmp/git2svn.lock ]; then echo "git2svn is already processing..." exit 0 else touch ~/tmp/git2svn.lock fi echo "$(date --iso-8601=minutes) === git2svn.sh sync repos ===" for repo in $HOME/repos/* ; do cd "${repo}" git checkout -b svn/git-svn git checkout svn/git-svn git svn fetch git svn rebase git checkout master git pull --rebase upstream master git checkout svn/git-svn MESSAGE=`git log --pretty=format:'%ai | %B [%an]' HEAD..master` git merge --no-ff --no-log -m "${MESSAGE}" master git svn dcommit git checkout master git merge svn/git-svn git push upstream master done rm ~/tmp/git2svn.lock
The trick is to use two different local only branches in which you do the merging vice versa. Just using one branch like master will cause serious issues.
Hi Tobias,
I have this situation that I would like to handle.
We are working with SVN but we would like to switch to Git and keep to update the SVN repo.
Can you clarify your script with an example?
Thanks,
Luigi
Hi Luigi,
Sorry for the late response.
What example do you need?
Maybe what I can say now, you should use git-svn (see https://git-scm.com/docs/git-svn) to create the git repo.