SlideShare uma empresa Scribd logo
1 de 19
Baixar para ler offline
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.

Mais conteúdo relacionado

Mais procurados

Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to GitlabJulien Pivotto
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHubNicolás Tourné
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020Noa Harel
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab IntroductionKrunal Doshi
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionAnwarul Islam
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubVenkat Malladi
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CIColCh
 
Git slides
Git slidesGit slides
Git slidesNanyak S
 
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Indonesia
 

Mais procurados (20)

Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to Gitlab
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020What's New for GitLab CI/CD February 2020
What's New for GitLab CI/CD February 2020
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
Git
GitGit
Git
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
Git Mastery
Git MasteryGit Mastery
Git Mastery
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git
GitGit
Git
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CI
 
Git slides
Git slidesGit slides
Git slides
 
Git flow
Git flowGit flow
Git flow
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
GITS Class #16: CI/CD (Continuous Integration & Continuous Deployment) with G...
 

Semelhante a Subversion to Git Migration

Semelhante a 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 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
 
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
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
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
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 

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.