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

Git vs SVN

denkeni
March 12, 2015

Git vs SVN

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

denkeni

March 12, 2015
Tweet

More Decks by denkeni

Other Decks in Programming

Transcript

  1. Git vs SVN
    @denkeni

    View Slide

  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"

    View Slide

  3. But git is more complex and requires more management
    than svn, definitely.

    View Slide

  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 -

    View Slide

  5. Remote-dependent(SVN)
    vs
    Local-Remote(Git)

    View Slide

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

    View Slide

  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

    View Slide

  8. A typical case of SVN
    One trunk development

    View Slide

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

    View Slide

  10. Remote
    Local
    trunk

    View Slide

  11. A typical case of git
    Branch merging development

    View Slide

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

    View Slide

  13. Remote
    Local
    master
    branch git commit
    master

    View Slide

  14. Remote
    Local
    master
    git checkout master
    branch
    master

    View Slide

  15. Remote
    Local
    master
    git merge $branch_name
    git push
    branch
    master (other people pushed something)

    View Slide

  16. Remote
    Local master
    branch
    master

    View Slide

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

    View Slide

  18. trunk
    master
    Remote
    Local

    View Slide

  19. Remote
    Local
    master
    trunk
    branch

    View Slide

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

    View Slide

  21. Remote
    Local
    trunk
    branch
    master

    View Slide

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

    View Slide

  23. Remote
    Local
    trunk
    master
    branch

    View Slide

  24. Remote
    Local
    trunk
    master
    git rebase master -i
    (solve conflicts)
    (squash commits into one)
    branch

    View Slide

  25. Remote
    Local
    trunk
    master
    branch

    View Slide

  26. Remote
    Local
    trunk
    master
    branch
    git merge branch

    View Slide

  27. Remote
    Local
    trunk
    branch
    master

    View Slide

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

    View Slide

  29. Remote
    Local
    trunk
    master
    branch

    View Slide

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

    View Slide

  31. View Slide

  32. View Slide

  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

    View Slide