Thursday, December 1, 2011

Git SVN Workflow

Fetch and import a Subversion repository into a local Git repository

git svn clone -s <svn repo> ./

Create and checkout a local topic branch to work on called task-1.

git checkout -b task-1

Create/delete/modify files then add any untracked files in your work directory to the Git index

git add .

Record all changes to the Git repository

git commit -a -m "Insert commit message here..."

Update master (local Subversion tracking branch) with any changes from Subversion

git checkout master
git svn rebase

Update task-1 with any changes to local master

git checkout task-1
git rebase -i master

To see any conflicts type

git diff

Fix conflicts by editing the files by hand or run git mergetool

Add the merged file(s) and finish the rebase

git add .
git rebase --continue

Merge changes from task-1 to local Master

git checkout master
git merge --ff-only task-1

Commit the changes from local Master to Subversion

git svn dcommit