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

Switching to Git – Why and How (ConFoo 2014)

Ben Straub
February 26, 2014

Switching to Git – Why and How (ConFoo 2014)

Git is an amazing tool for making software. Are you wondering what the fuss is about?

If you're currently using another system, and are thinking of making a switch to Git, this is the talk for you. Find out what it is that makes Git so attractive to developers, and how it can help with deployment, ops, and testing.

Ben Straub

February 26, 2014
Tweet

More Decks by Ben Straub

Other Decks in Programming

Transcript

  1. # file1 blah blah blah work for feature A blah

    blah work for feature B # file2 blah blah blah work for feature B blah blah work for feature A
  2. # file1 blah blah blah work for feature A blah

    blah work for feature B # file2 blah blah blah work for feature B blah blah work for feature A
  3. # file1 blah blah blah work for feature A blah

    blah work for feature B # file2 blah blah blah work for feature B blah blah work for feature A
  4. # file1 blah blah blah work for feature A blah

    blah # file2 blah blah blah blah blah work for feature A
  5. # file1 blah blah blah work for feature A blah

    blah # file2 blah blah blah blah blah work for feature A
  6. # file1 blah blah blah work for feature A blah

    blah wrok for feture B # file2 blah blah blah mayk feetchur B blah blah work for feature A
  7. # file1 blah blah blah work for feature A blah

    / fix #7 blah wrok for feture B # file2 blah blah / fix #2 blah mayk feetchur B blah blah work for feature A
  8. # file1 blah blah blah work for feature A blah

    blah work for feature B # file2 blah blah blah work for feature B blah blah work for feature A
  9. # file1 blah blah blah work for feature A blah

    blah work for feature B # file2 blah blah blah work for feature B blah blah work for feature A
  10. # file1 blah blah blah work for feature A blah

    blah work for feature B # file2 blah blah blah work for feature B blah blah work for feature A
  11. log (10 entries) svn: 1.2s git: 0.008s show svn: 6.2s

    git: .009s 150x faster 689x faster commit svn: 44s git: 0.2s 220x faster
  12. Authors File cvorca ben l33rj3t17 bob johnnyappleseed employee27451 cvorca <cvorca@1F800880-4661-4327-91

    ben <ben@667A2361-E072-466A-B718-C1C l33rj3t17 <l33rj3t17@C57B291D-641B-4 bob <bob@548E9AC8-FE11-442C-8D0D-C74 johnnyappleseed <johnnyappleseed@F3E employee27451 <employee27451@C4DEE07
  13. #

  14. ›❯ mkdir newrepo; cd newrepo ›❯ git init Initialized empty

    Git repository in /tmp/newrepo/.git/ ›❯ ls -a . .. .git ›❯ Make a Repository
  15. ›❯ mkdir newrepo; cd newrepo ›❯ git init Initialized empty

    Git repository in /tmp/newrepo/.git/ ›❯ ls -a . .. .git ›❯ Make a Repository
  16. ›❯ mkdir newrepo; cd newrepo ›❯ git init Initialized empty

    Git repository in /tmp/newrepo/.git/ ›❯ ls -a . .. .git ›❯ Make a Repository
  17. Clone a Repository ›❯ git clone https://github.com/jquery/jquery Cloning into 'jquery'...

    remote: Reusing existing pack: 32101, done. remote: Total 32101 (delta 0), reused 0 (delta 0) Receiving objects: 100% (32101/32101), 17.69 MiB | 1.04 MiB/ done. Resolving deltas: 100% (22737/22737), done. ›❯ cd jquery ›❯ ls -a . .gitignore .travis.yml bower.json .. .jscs.json AUTHORS.txt build .bowerrc .jshintignore CONTRIBUTING.md package.json
  18. Clone a Repository ›❯ git clone https://github.com/jquery/jquery Cloning into 'jquery'...

    remote: Reusing existing pack: 32101, done. remote: Total 32101 (delta 0), reused 0 (delta 0) Receiving objects: 100% (32101/32101), 17.69 MiB | 1.04 MiB/ done. Resolving deltas: 100% (22737/22737), done. ›❯ cd jquery ›❯ ls -a . .gitignore .travis.yml bower.json .. .jscs.json AUTHORS.txt build .bowerrc .jshintignore CONTRIBUTING.md package.json
  19. Clone a Repository ›❯ git clone https://github.com/jquery/jquery Cloning into 'jquery'...

    remote: Reusing existing pack: 32101, done. remote: Total 32101 (delta 0), reused 0 (delta 0) Receiving objects: 100% (32101/32101), 17.69 MiB | 1.04 MiB/ done. Resolving deltas: 100% (22737/22737), done. ›❯ cd jquery ›❯ ls -a . .gitignore .travis.yml bower.json .. .jscs.json AUTHORS.txt build .bowerrc .jshintignore CONTRIBUTING.md package.json
  20. remote: Reusing existing pack: 32101, done. remote: Total 32101 (delta

    0), reused 0 (delta 0) Receiving objects: 100% (32101/32101), 17.69 MiB | 1.04 MiB/ done. Resolving deltas: 100% (22737/22737), done. ›❯ cd jquery ›❯ ls -a . .gitignore .travis.yml bower.json .. .jscs.json AUTHORS.txt build .bowerrc .jshintignore CONTRIBUTING.md package.json .editorconfig .jshintrc Gruntfile.js speed .git .mailmap MIT-LICENSE.txt src .gitattributes .npmignore README.md test
  21. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui &
  22. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui &
  23. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui &
  24. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui &
  25. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui & ›❯ git log --oneline bd7b055 Add awesome new feature!!1!! 34c5978 Initial commit
  26. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui & ›❯ git log --oneline bd7b055 Add awesome new feature!!1!! 34c5978 Initial commit
  27. Do Some Work ›❯ git checkout -b new-feature Switched to

    a new branch 'new-feature' ›❯ echo “awesome stuff” >> main.c ›❯ git gui & ›❯ git log --oneline bd7b055 Add awesome new feature!!1!! 34c5978 Initial commit
  28. Give To Others ›❯ git remote add origin https://github.com/mycorp/projec ›❯

    git push -u origin new-feature Counting objects: 6, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 451 bytes, done. Total 6 (delta 1), reused 0 (delta 0) To https://github.com/mycorp/project.git * [new branch] new-feature -> new-feature ›❯ # more work
  29. Give To Others ›❯ git remote add origin https://github.com/mycorp/projec ›❯

    git push -u origin new-feature Counting objects: 6, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 451 bytes, done. Total 6 (delta 1), reused 0 (delta 0) To https://github.com/mycorp/project.git * [new branch] new-feature -> new-feature ›❯ # more work
  30. ›❯ git remote add origin https://github.com/mycorp/projec ›❯ git push -u

    origin new-feature Counting objects: 6, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 451 bytes, done. Total 6 (delta 1), reused 0 (delta 0) To https://github.com/mycorp/project.git * [new branch] new-feature -> new-feature ›❯ # more work ›❯ git push Counting objects: 5, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 263 bytes, done.
  31. ›❯ git remote add origin https://github.com/mycorp/projec ›❯ git push -u

    origin new-feature Counting objects: 6, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 451 bytes, done. Total 6 (delta 1), reused 0 (delta 0) To https://github.com/mycorp/project.git * [new branch] new-feature -> new-feature ›❯ # more work ›❯ git push Counting objects: 5, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 263 bytes, done.
  32. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 451

    bytes, done. Total 6 (delta 1), reused 0 (delta 0) To https://github.com/mycorp/project.git * [new branch] new-feature -> new-feature ›❯ # more work ›❯ git push Counting objects: 5, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 263 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To https://github.com/ben/temp.git bd7b055..0adf488 new-feature -> new-feature
  33. Take From Others ›❯ git branch master * new-feature ›❯

    git branch -a master * new-feature remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch
  34. Take From Others ›❯ git branch master * new-feature ›❯

    git branch -a master * new-feature remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch
  35. Take From Others ›❯ git branch master * new-feature ›❯

    git branch -a master * new-feature remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch
  36. Take From Others ›❯ git branch master * new-feature ›❯

    git branch -a master * new-feature remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0)
  37. Take From Others ›❯ git branch master * new-feature ›❯

    git branch -a master * new-feature remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0)
  38. * new-feature ›❯ git branch -a master * new-feature remotes/origin/HEAD

    -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From https://github.com/mycorp/project bd7b055..c88ae4b master -> origin/master ›❯ git merge origin/master -m 'Merging upstream work' Auto-merging main.c Merge made by the 'recursive' strategy. main.c | 1 +
  39. * new-feature ›❯ git branch -a master * new-feature remotes/origin/HEAD

    -> origin/master remotes/origin/master remotes/origin/new-feature ›❯ git fetch remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From https://github.com/mycorp/project bd7b055..c88ae4b master -> origin/master ›❯ git merge origin/master -m 'Merging upstream work' Auto-merging main.c Merge made by the 'recursive' strategy. main.c | 1 +
  40. remotes/origin/new-feature ›❯ git fetch remote: Counting objects: 5, done. remote:

    Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From https://github.com/mycorp/project bd7b055..c88ae4b master -> origin/master ›❯ git merge origin/master -m 'Merging upstream work' Auto-merging main.c Merge made by the 'recursive' strategy. main.c | 1 + 1 file changed, 1 insertion(+) ›❯ git push newrepo2/git/new-feature Counting objects: 7, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done.
  41. remotes/origin/new-feature ›❯ git fetch remote: Counting objects: 5, done. remote:

    Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From https://github.com/mycorp/project bd7b055..c88ae4b master -> origin/master ›❯ git merge origin/master -m 'Merging upstream work' Auto-merging main.c Merge made by the 'recursive' strategy. main.c | 1 + 1 file changed, 1 insertion(+) ›❯ git push newrepo2/git/new-feature Counting objects: 7, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done.
  42. Auto-merging main.c Merge made by the 'recursive' strategy. main.c |

    1 + 1 file changed, 1 insertion(+) ›❯ git push newrepo2/git/new-feature Counting objects: 7, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 305 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To /tmp/newrepo 0adf488..68f178c new-feature -> new-feature
  43. $