Git SVN

From miki
Revision as of 10:25, 12 July 2011 by Mip (talk | contribs) (→‎Workflow)
Jump to navigation Jump to search

This page is dedicated to Subversion integration in Git

References

Workflow

Get a clone of subversion repository with:

# git: git clone => 
# svn: svn checkout =>
git svn clone https://www.mysvn.org/svn/project -T trunk -b branches -t tags --username='USER'
git svn clone https://www.mysvn.org/svn/project --stdlayout --username='USER'                   # Identical
# Clean / compress git DB if necessary...
git gc

Fetch all changes from SVN repo:

# git: git fetch =>
git svn fetch

Fetch and merge all changes from SVN repo:

# git: git pull =>
# svn: svn update =>
git svn rebase
git svn rebase -l                   # Only rebase against last fetched commit from upstream SVN
In case of conflicts (see [1]):
  • You are on a (no-branch) branch (with git status showing a .dotest file you can ignore)
  • Use the usual git rebase --abort (to bail out), git rebase --continue (solved conflict), git rebase --skip (no-op patch)

Send local changes to SVN repo:

# git: git push =>
git svn dcommit

Annotate changes in a file:

# git: git blame =>
# svn: svn annotate/blame =>
git svn blame fullpath              # Only accept full path! (from project rootdir)
git blame file