Surprisingly SVN is still the commonly used version control system out there with some enterprises. However this should not hamper the developer from using all the cool features and workflows that GIT provides. GIT comes with built in support to migrate a svn repository to GIT and even better, it allows you to work with SVN as the centralized repo. Simpy put Git SVN bridge provides bidirectional operation between a Subversion repository and Git
The following are the commands and typical workflow structure that you would use most of the time working with SVN as centralized repo and having GIT as your local development repository.

For folks who are familiar with tortoiseSVN, the tortoiseGIT GUI tool will make you feel at home. Nonetheless you still need to know which command to use to get the job done.

  1. git svn clone http(s)://svn-repo-url
    This command gets all the given svn repos trunk, branches,tags into the local git repository. Ensure your svn repo uses the common “trunk/branches/tags” layout. Else you can manually specify them. It will automatically create a directory based on the basename of the URL passed to it. From here you work with your local GIT repository as you normally would with any GIT repo.

  2. git svn dcommit
    Commits all the git repo changes to svn remote repo

  3. git svn rebase
    Gets all the latest contents from svn remote repo to local git repo

  4. When you do a git svn rebase and If there are conflicting changes between remote svn repo and local git repo, do the following:
    a.) Merge the changes using any of your favorite editor.
    b.) git add filename
    c.) git rebase –continue
    d.) git svn dcommit

  5. git status
    show the working tree status

  6. git log
    show commit logs

  7. git add [.|filename]
    Add file contents to the index

  8. git commit -m “message”
    Record changes to the local git repository
“I hear and I forget. I see and I remember. I do and I understand.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>