Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Last active September 19, 2016 13:59
Show Gist options
  • Save jeremyboggs/ea3b737ab16f6a5621eac7a8ad3e325d to your computer and use it in GitHub Desktop.
Save jeremyboggs/ea3b737ab16f6a5621eac7a8ad3e325d to your computer and use it in GitHub Desktop.
A Git-SVN workflow that uses both a SVN and Github remote

A Git-SVN Workflow

Scenario: There is a private Subversion repository that is the primary repository for a project. I still need to push, and pull, from that repo, while also using a remote Github repo as the primary place to save ongoing work, issues, etc.

Workflow

  • Subversion repo uses a non-standard layout; No trunk, no branches.
  • Git repo uses a modified version of git-flow.
    • The master branch is a mirror of the Subversion repo. Never commit to that directly. Or, if I do, I immediate do git svn dcommit before makign topic branches.
    • Topic branches for features and bug-fixes, off of master.
    • No develop branch. That branch is omitted because of issues with merging master into develop after pushing to subversion.
git co master
git svn rebase
git checkout -b feature/new-feature
git commit 
git co master
git merge feature/new-feature
git svn dcommit
git push

The order of the last two steps is important, to continue to be able to do new topic branches off of the master branch. git svn dcommit creates commits in the style of Subversion. that should be done first, in the master branch, before pushing up to your Git remote. Otherwise, subsequent application of git svn rebase causes merge conflicts, where you'll have two separate commits for the same changes: One for Subversion and one for Git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment