git-svn

git svn clone http://svn.example.org/svn/my-project my-project-git -T trunk -t tags -b branches
cd my-project-git
git svn fetch

If there are files you don’t want to commit, it may make sense to ignore them. If you use .gitignore then you’ll have to avoid committing that file. Instead, add it to .git/info/exclude

Overall flow:

  • Subversion branches mapped to git branches
  • Choose the appropriate git branch
  • Create temporary local git branches as necessary, including for stashing temporary work, including when it’s in svn code review
  • Use svn-based code review approach. To get the diff:
git checkout feature-branch
  • When ready to actually commit to a svn branch, make one or more linear commits to the corresponding git branch. Squash merge is usually helpful
git checkout main
git svn rebase
git checkout feature-branch
git rebase main
git checkout main
git merge --squash feature-branch
git commit -m "Commit comment"
  • git svn dcommit pushes those git commits up as svn commits
  • Pull the latest from svn: gist svn rebase

Patch Files

git format-patch main --stdout > my-patch-file-name.patch