SlideShare a Scribd company logo
Case Study:
   Introduction
     Distributed Source Code Control
     Git’s Features
     Benefits of Git over SVN

   SVN to Git Migration
     Migrating from SVN to Git
     How to use Git with SVN
   Conclusion
   Sources
Section I
Repositories     URL       Revisions



 Commits       Commands     Colors



               Visualize
 With Subversion, for each project there is a single
  repository at some detached central place where all
  the history is and which you checkout and commit
  into.
 Git works differently, each copy of the project tree
  (we call that the working copy) carries its own
  repository around (in the .git subdirectory in the
  project tree root). So you can have local and remote
  branches.
 You can also have a so-called bare repository which is
  not attached to a working copy; that is useful
  especially when you want to publish your repository
 In Subversion the URL identifies the location of
  the repository and the path inside the
  repository, so you organize the layout of the
  repository and its meaning.
 Normally you would have trunk/, branches/ and
  tags/ directories.
 In Git the URL is just the location of the
  repository, and it always contains branches and
  tags.
 One of the branches is the default (normally
  named master).
 Subversion identifies revisions with ids of decimal
  numbers growing monotonically which are typically
  small (although they can get quickly to hundreds of
  thousands for large projects). That is impractical in
  distributed systems like Git.
 Git identifies revisions with SHA1 ids, which are long
  160-bit numbers written in hexadecimal. It may look
  scary at first, but in practice it is not a big hurdle - you
  can refer to the latest revision by HEAD, its parent as
  HEAD^ and its parent as HEAD^^ = HEAD~2 (you can
  go on adding carrets
 Each commit has an author and a committer field,
  which record who and when created the change and
  who committed it
 Git is designed to work well with patches coming by
  mail - in that case, the author and the committer will
  be different.
 Git will try to guess your realname and email, but
  especially with email it is likely to get it wrong. You
  can check it using git config -l and set them with:
     git config --global user.name "Your Name Comes Here"
     git config --global user.email
      you@yourdomain.example.com
   The Git commands are in the form “git
    command <command_name>”.
     Eg- “git commit …. “
   You can interchangeably use the git-
    command form as well
     Eg “git-commit ….”
   Git can produce colorful output for
    commands
   Colors are disabled by default
   Watch your repository using the gitk
    repository viewer as you go.
SVN   Git
Section II
Import your SVN repo into Git

• git svn clone https://svn.foo.com/svn/proj --trunk=trunk --branches=branches --tags=tags

Make your own Git branch

• git checkout -b work trunk

Add the files you changed

• git add <filename>

Commit

• git commit

Want to sync with master SVN?

• git svn dcommit
   Why would we want this?
     Since Git is a distributed revision control system
      (while svn is a centralized one) you can perform
      commits, brances and merges on your local working
      dir.
     When you want, you will be able to “push” your
      changes back to the central SVN server
   What are the advantages of this approach?
     No downtime. Smooth migration
     Existing system can run as-is while hooks are being
      written to integrate git into the system.
• install git and git-svn
Install


          • create the working dir
Create


          • init your git working dir:
 Init     • cd <workdir> && git-svn init http://your_repo

          • Find a commit regarding the project
 Find     • the command git-log will show project’s history starting from this revision

          • Perform the command git-svn fetch –rREVISION
Fetch     • Where REVISION is the number obtained before.


          • Update your working dir: git-svn rebase
Update


          • You can commit your changes using git-svn dcommit
Commit
 Sometimes, you may experience some problem when
  synchronizing with the main development tree.
 In fact you have to commit all local modifications (using the git-
  commit command) before invoking git-svn rebase.
 Sometimes it isn’t reasonable since your changes are not yet ready
  to be committed.
 git has a native solution also for this problem, just follow these
  steps:
       put aside your changes using the command: git-stash
       update your working copy using: git-svn rebase as usual
       take back your changes typing: git-stash apply
       clear the stash by typing: git-stash clear
 After the first step all your uncommitted changes will disappear
  from the working copy, so you’ll be able to perform the rebase
  command without problems.
 For further informations read git-stash man page.
   A DSCM gives a lot of flexibility when
    development is happening across various
    team.
   Care needs to be taken while doing an SVN
     git migration.
   SVN & git should be used simultaneously
    until the team is confident about git.

More Related Content

What's hot

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 
Git basics
Git basicsGit basics
Git basics
GHARSALLAH Mohamed
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 
Git real slides
Git real slidesGit real slides
Git real slides
Lucas Couto
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Suman Mukherjee
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Somkiat Puisungnoen
 
Git (Internals)
Git (Internals)Git (Internals)
Git (Internals)
Sabin Bhatta
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Rueful Robin
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
Taisuke Inoue
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Rupesh Kumar
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Simplilearn
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
Sumin Byeon
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
KMS Technology
 
Git training v10
Git training v10Git training v10
Git training v10
Skander Hamza
 

What's hot (20)

Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git basics
Git basicsGit basics
Git basics
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Learning git
Learning gitLearning git
Learning git
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git (Internals)
Git (Internals)Git (Internals)
Git (Internals)
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Git with bitbucket
Git with bitbucketGit with bitbucket
Git with bitbucket
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git training v10
Git training v10Git training v10
Git training v10
 

Similar to Subversion to Git Migration

Git
GitGit
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
9 series
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
Tilton2
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
RaghavendraVattikuti1
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 
Git
GitGit
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
Nyros Technologies
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur16
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
Soumen Debgupta
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
AliaaTarek5
 
Git
GitGit
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1
 
Git
GitGit
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
Terry Wang
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
Bimal Jain
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf

Similar to Subversion to Git Migration (20)

Git
GitGit
Git
 
Git for developers
Git for developersGit for developers
Git for developers
 
Git 101
Git 101Git 101
Git 101
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Git hub
Git hubGit hub
Git hub
 
Git
GitGit
Git
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 
Git
GitGit
Git
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Git
GitGit
Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 

Subversion to Git Migration

  • 2. Introduction  Distributed Source Code Control  Git’s Features  Benefits of Git over SVN  SVN to Git Migration  Migrating from SVN to Git  How to use Git with SVN  Conclusion  Sources
  • 4.
  • 5. Repositories URL Revisions Commits Commands Colors Visualize
  • 6.  With Subversion, for each project there is a single repository at some detached central place where all the history is and which you checkout and commit into.  Git works differently, each copy of the project tree (we call that the working copy) carries its own repository around (in the .git subdirectory in the project tree root). So you can have local and remote branches.  You can also have a so-called bare repository which is not attached to a working copy; that is useful especially when you want to publish your repository
  • 7.  In Subversion the URL identifies the location of the repository and the path inside the repository, so you organize the layout of the repository and its meaning.  Normally you would have trunk/, branches/ and tags/ directories.  In Git the URL is just the location of the repository, and it always contains branches and tags.  One of the branches is the default (normally named master).
  • 8.  Subversion identifies revisions with ids of decimal numbers growing monotonically which are typically small (although they can get quickly to hundreds of thousands for large projects). That is impractical in distributed systems like Git.  Git identifies revisions with SHA1 ids, which are long 160-bit numbers written in hexadecimal. It may look scary at first, but in practice it is not a big hurdle - you can refer to the latest revision by HEAD, its parent as HEAD^ and its parent as HEAD^^ = HEAD~2 (you can go on adding carrets
  • 9.  Each commit has an author and a committer field, which record who and when created the change and who committed it  Git is designed to work well with patches coming by mail - in that case, the author and the committer will be different.  Git will try to guess your realname and email, but especially with email it is likely to get it wrong. You can check it using git config -l and set them with:  git config --global user.name "Your Name Comes Here"  git config --global user.email you@yourdomain.example.com
  • 10. The Git commands are in the form “git command <command_name>”.  Eg- “git commit …. “  You can interchangeably use the git- command form as well  Eg “git-commit ….”
  • 11. Git can produce colorful output for commands  Colors are disabled by default
  • 12. Watch your repository using the gitk repository viewer as you go.
  • 13. SVN Git
  • 15. Import your SVN repo into Git • git svn clone https://svn.foo.com/svn/proj --trunk=trunk --branches=branches --tags=tags Make your own Git branch • git checkout -b work trunk Add the files you changed • git add <filename> Commit • git commit Want to sync with master SVN? • git svn dcommit
  • 16. Why would we want this?  Since Git is a distributed revision control system (while svn is a centralized one) you can perform commits, brances and merges on your local working dir.  When you want, you will be able to “push” your changes back to the central SVN server  What are the advantages of this approach?  No downtime. Smooth migration  Existing system can run as-is while hooks are being written to integrate git into the system.
  • 17. • install git and git-svn Install • create the working dir Create • init your git working dir: Init • cd <workdir> && git-svn init http://your_repo • Find a commit regarding the project Find • the command git-log will show project’s history starting from this revision • Perform the command git-svn fetch –rREVISION Fetch • Where REVISION is the number obtained before. • Update your working dir: git-svn rebase Update • You can commit your changes using git-svn dcommit Commit
  • 18.  Sometimes, you may experience some problem when synchronizing with the main development tree.  In fact you have to commit all local modifications (using the git- commit command) before invoking git-svn rebase.  Sometimes it isn’t reasonable since your changes are not yet ready to be committed.  git has a native solution also for this problem, just follow these steps:  put aside your changes using the command: git-stash  update your working copy using: git-svn rebase as usual  take back your changes typing: git-stash apply  clear the stash by typing: git-stash clear  After the first step all your uncommitted changes will disappear from the working copy, so you’ll be able to perform the rebase command without problems.  For further informations read git-stash man page.
  • 19. A DSCM gives a lot of flexibility when development is happening across various team.  Care needs to be taken while doing an SVN  git migration.  SVN & git should be used simultaneously until the team is confident about git.