Getting started with git svn

1,031 views

Published on

Getting started with git svn

  • Be the first to comment

Getting started with git svn

  1. 1. Getting started with gitsvn Manij Shrestha
  2. 2. Who? ● Git user who needs to work on project that uses SVN ● SVN users who wants to learn Git ● Because you can
  3. 3. Why? ● Able to work on multiple branches from same project directory. ● No need to be on VPN to pull the revision history. ● Local branches, Stashing, local commits
  4. 4. How? $ git svn clone svn://internal-repo/Project Project -s (-s == Standard model, trunk, branches, tags) OR $ git svn clone svn://internal-repo/Project Project --trunk=trunk --branches=maintenance/* --prefix=git-svn/ prefix must trail with “/” OR $ git svn init svn://internal-repo/Project Project --trunk=trunk --branches=maintenance/* --prefix=git-svn/ $ git svn fetch
  5. 5. Taking a look @ .git/config SVN SVN: GIT:
  6. 6. Pulling selective branch. If you only want to pull few branches. Edit “.git/config” Add branch name(s), inside “{}” $ git svn fetch SVN
  7. 7. Getting Latest Code $ git svn rebase Not “git pull”
  8. 8. commit $ git svn rebase (similar to ‘git pull’/ ‘svn update’, will rewind your changes and applies your changes on top) $ git svn dcommit SVN Each “git commit” will be checked in as separate revision in SVN.
  9. 9. Working on branch $ git checkout -b branch2 refs/remotes/git-svn/branch2 Don’t forget the refs/ You can now commit and dcommit on this branch ● Merge is not recommended (Tree conflicts, commit to wrong branch). Merge branches in SVN.
  10. 10. Linear history Always have a linear history. SVN GIT LOST
  11. 11. Summary git svn init review .git/config git svn fetch git commit.. commit.. commit.. git svn rebase git svn dcommit git stash… git branch.. Linear History...

×