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.
- 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 dogit 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.
- The
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.