Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git vs SVN

March 12, 2015

Git vs SVN

A Git introduction for SVN users. Including bidirectional bridge Git-Svn.


March 12, 2015

More Decks by denkeni

Other Decks in Programming


  1. Git vs SVN @denkeni

  2. Git - first impressions • Distributed Version Control System •

    Created by Linus Torvalds for Linux kernel project management. • Fast, lightweight. • GitHub • "Local branching on the cheap"
  3. But git is more complex and requires more management than

    svn, definitely.
  4. Git SVN git clone svn checkout git checkout xxx.m svn

    revert xxx.m git checkout $branch_name svn switch $branch_url git checkout $commit svn merge -r301:300 xxx.m svn commit git reset --hard HEAD svn revert -R . git pull (= git fetch + git merge) svn update git revert $commit -
  5. Remote-dependent(SVN) vs Local-Remote(Git)

  6. Uncommitted (Local) Committed (Remote) svn commit

  7. Uncommitted (Local) Committed (Remote) svn commit Working space/directory Index /

    Staging area Local repository Remote repository git add xxx.m git commit git push
  8. A typical case of SVN One trunk development

  9. svn update (solve conflicts) svn commit trunk Remote Local

  10. Remote Local trunk

  11. A typical case of git Branch merging development

  12. master Remote Local master git branch $branch_name git checkout $branch_name

  13. Remote Local master branch git commit master

  14. Remote Local master git checkout master branch master

  15. Remote Local master git merge $branch_name git push branch master

    (other people pushed something)
  16. Remote Local master branch master

  17. (Git-SVN: Use Git client for SVN remote repository) My Git-SVN

  18. trunk master Remote Local

  19. Remote Local master trunk branch

  20. Remote Local master trunk git svn rebase (≈git pull) (≈svn

    update) branch
  21. Remote Local trunk branch master

  22. Remote Local trunk master git rebase master (solve conflicts) branch

  23. Remote Local trunk master branch

  24. Remote Local trunk master git rebase master -i (solve conflicts)

    (squash commits into one) branch
  25. Remote Local trunk master branch

  26. Remote Local trunk master branch git merge branch

  27. Remote Local trunk branch master

  28. Remote Local trunk master git svn dcommit (≈git push) branch

  29. Remote Local trunk master branch

  30. "A successful Git branching model." Git Flow

  31. None
  32. None
  33. Learning Resources • 《Pro Git》by Scott Chacon(範例多易學,有中文版) http://git-scm.com/book/ • Try

    Git: Code School(線上學 Git 指令) https://try.github.io/ • ihower 的《Git版本控制系統》 http://ihower.tw/git/ • Will 保哥的《30 天精通 Git 版本控管》(深入淺出) https://github.com/doggy8088/Learn-Git-in-30-days • GitSvnComparison https://git.wiki.kernel.org/index.php/GitSvnComparsion • Tech Talk: Linus Torvalds on git http://youtu.be/4XpnKHJAok8