getting started with git svn

11
Getting started with git- svn Manij Shrestha

Upload: manij-shrestha

Post on 30-Nov-2014

356 views

Category:

Technology


1 download

DESCRIPTION

Getting started with git svn

TRANSCRIPT

Page 1: Getting started with git svn

Getting started with git-svn

Manij Shrestha

Page 2: Getting started with git svn

Who?● Git user who needs to work on project that uses SVN

● SVN users who wants to learn Git

● Because you can

Page 3: Getting started with git svn

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

Page 4: Getting started with git svn

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

Page 5: Getting started with git svn

Taking a look @ .git/config

SVN:

GIT:

SVN

Page 6: Getting started with git svn

Pulling selective branch.If you only want to pull few branches.Edit “.git/config”Add branch name(s), inside “{}”

$ git svn fetch

SVN

Page 7: Getting started with git svn

Getting Latest Code

$ git svn rebase

Not “git pull”

Page 8: Getting started with git svn

commit$ git svn rebase (similar to ‘git pull’/ ‘svn update’, will rewind your changes and applies your changes on top)$ git svn dcommit

Each “git commit” will be checked in as separate revision in SVN. SVN

Page 9: Getting started with git svn

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.

Page 10: Getting started with git svn

Linear historyAlways have a linear history.

SVN GIT

LOST

Page 11: Getting started with git svn

Summarygit svn initreview .git/configgit svn fetchgit commit.. commit.. commit..git svn rebasegit svn dcommitgit stash… git branch..Linear History...