Skip to content

Instantly share code, notes, and snippets.

@rjung-guidance
Forked from ticean/SVN_Git_Mirror.md
Created January 3, 2012 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjung-guidance/1557095 to your computer and use it in GitHub Desktop.
Save rjung-guidance/1557095 to your computer and use it in GitHub Desktop.
SVN Git Mirror

Bridging SVN & Git

This guide will demonstrate how to mirror SVN commits over to GIT. Work in progress...

References

First off, I'll give some credits. I've lifed all this information from various placed on the web.

Creating the Local Git Repository

# Clone an SVN repo with Git
git svn init -s http://svn.yourdomain.com/repos/project_name
cd project_name

# Fetch the SVN branches to the local Git repo
git svn fetch

# Once this is done, you’re local 'master' branch is linked to trunk/.
# Make a new branch for develop & check it out
git checkout -b develop 

# Back to master.
git checkout master

# We'll change this to link local 'develop' branch to trunk
git reset --hard production

Adding a Git remote

Now we have Git branches properly mapped to SVN branches. But, our only remote is the SVN repostory.

Either use an existing Git repository, or create a new one. You will need the remote Git URL to add the remote.

git remote add origin git@github.com:guidance/emergencylink.git

"origin" -- Guidance GIT repository for ICE (git@github.com:guidance/emergencylink.git)

Show current branches $ git branch -va

Switch branches $ git checkout master

Pull latest from SVN $ git svn rebase

Push changes to Github: $ git push $ git push origin develop

Merge another branch into the current: $ git merge

Pull latest SVN repository to local git repository: $ git checkout develop // Switch to develop branch $ get svn rebase // Get latest stuff from repository $ git push origin develop // Send code to Github repository

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