Tech thursdays / GIT

411 views

Published on

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
411
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tech thursdays / GIT

  1. 1. Będzie Git mam nadzieje...
  2. 2. Git / Why should I care? http://www.google.com/trends/explore#cat=0-5-32&q=git%2C%20subversion%2C%20mercurial&cmpt=q
  3. 3. Git / What is Git ? Git is an open source distributed version control system designed for speed and efficiency. Initially designed and developed by Linus Torvalds for Linux kernel development.
  4. 4. Git / What is Git ? Git is an open source distributed version control system designed for speed and efficiency. Initially designed and developed by Linus Torvalds for Linux kernel development.
  5. 5. Git / What's Linus likes ?
  6. 6. Git / What's Linus likes ?
  7. 7. Git / Open Source Git is an open source distributed version control system designed for speed and efficiency. Initially designed and developed by Linus Torvalds for Linux kernel development.
  8. 8. Git / Distributed Git is an open source distributed version control system designed for speed and efficiency. Initially designed and developed by Linus Torvalds for Linux kernel development.
  9. 9. Git / Central vs Distributed Computer A checkout file Computer checkout file Central VCS version database version 1 version 2 version 3
  10. 10. Git / Central vs Distributed Computer A version database file version 1 version 2 Computer A version database file version 1 version 2 Server Computer version database version 1 version 2
  11. 11. Git / Efficiency Git is an open source distributed version control system designed for speed and efficiency. Initially designed and developed by Linus Torvalds for Linux kernel development.
  12. 12. Git / Efficiency Not a shrink wrap product, so not quite what we are doing, however facebook have 700 developers, with new code pushed out daily http://venturebeat.com/2012/08/03/facebook-code/ Our merging process seems to have slowed down, where merges are now held until the end of the iteration. We need to become more rapid and have user stories accepted earlier in the iteration cycle, with more regular and smaller merges taking place throughout the iteration. Cheers, XXX Software Development Engineering Manager
  13. 13. Git / Efficiency
  14. 14. Git / Efficiency
  15. 15. Git /Efficiency $ time to deliver (time to market) + additional costs (disk space,..) = methodologies version control system open-source projects programming languages (functional/lambda = less code) modular architecture continuous integration test automation continuous deployment monitoring driven development
  16. 16. Git / Delta based storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 index.html style.css main.js Δ1 Δ2 Δ3 Δ5 Δ7 Δ8 homt.html Δ6
  17. 17. Git / Delta based storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 index.html style.css main.js Δ1 Δ2 Δ3 Δ5 Δ7 Δ8 homt.html Δ6
  18. 18. Git / Delta based storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 index.html style.css main.js Δ1 Δ2 Δ3 Δ5 Δ7 Δ8 homt.html Δ6
  19. 19. Git / Delta based storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 index.html style.css main.js Δ1 Δ2 Δ3 Δ5 Δ7 Δ8 homt.html Δ6
  20. 20. Git / Delta based storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 index.html style.css main.js Δ1 Δ2 Δ3 Δ5 Δ7 Δ8 homt.html Δ6
  21. 21. Git / Delta based storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 index.html style.css main.js Δ1 Δ2 Δ3 Δ5 Δ7 Δ8 homt.html Δ6
  22. 22. Git / Direct Acyclic Graph Storage Commit 1 Commit 2 Commit 3 Commit 4 Commit 5 entity 1 entity 2 entity 3 entity 4 entity 5 entity 6 entity 8 entity 9 entity 0 entity 7 entity 6
  23. 23. Git / Direct Acyclic Graph Directed Graph Arcs Connecting the nodes are directional.
  24. 24. Git / Direct Acyclic Graph A->B->C->D->A is a CYCLE Acyclic graphs have NO CYCLES A C B D
  25. 25. Git / Source control taxonomy delta storage local centralized distributed rcs cvs cvs perforce darcs mercurial dag storage local centralized distributed cp -r time machine bitkeeper git bazaar
  26. 26. Git / Meat .git config file hooks index object database references
  27. 27. Git / Object database .git config file hooks index object database references
  28. 28. Git / Object database / Algorithm new_content = type + ’ ‘ + content.size + 0 + content sha = Digest::SHA1.hexdigest(new_content) “824aed035c0aa75d64c...” compressed = zlib::deflate(new_content) path = “.git/objects/82/4aed035c0aa75d64c...” File.open(path, ‘w’) {|f| f.write(compressed)} http://alblue.bandlem.com/2011/08/git-tip-of-week-objects.html
  29. 29. Git / Object database / GC git gc .git/objects/82/4aed035c0aa75d64c... .git/objects/1d/c9cbcb76cbb80fce1... .git/objects/63/874f37013c1740acd... .git/objects/04/fb8aee105e6e445e8... .git/objects/45/b983be36b73c0788d... .git/objects/f1/032eed02413a1145c... .git/objects/pack/pack-999727..9f600.pack .git/objects/pack/pack-999727..9f600.idx http://alblue.bandlem.com/2011/09/git-tip-of-week-objects-and-packfiles.html
  30. 30. Git / Object database blob tree commit tag
  31. 31. FILE =============== srutu tutu majtki z drutu Git / Object database / Blob blob [content size]0 blob : a906cb zlib::deflate http://alblue.bandlem.com/2011/09/git-tip-of-week-objects-and-packfiles.html
  32. 32. Git / Object database / Tree ./ blob : a874b7 blob : a906cb tree : fe8971 blob : a0a60a tree : 1a738d index.html js/ main.js README
  33. 33. 100644 blob a874b7 README 100644 blob a906cb index.html 040000 tree fe8971 js Git / Object database / Tree tree [content size]0 tree : 1a738d zlib::deflate http://alblue.bandlem.com/2011/08/git-tip-of-week-trees.html
  34. 34. Git / Object database / Commit commit blob blob tree blob tree tree
  35. 35. http://alblue.bandlem.com/2011/09/git-tip-of-week-commits.html tree e1b3ec parent a11bef author Marek Prochera <marek.prochera@gmail.com> 1205624433 committer Marek Prochera <marek.prochera@gmail.com> 1205624433 my second commit Git / Object database / Commit commit [content size]0 commit : e1b3ec zlib::deflate
  36. 36. Git / Object database / Tag tag tree blob commit
  37. 37. object 0576fa type commit tag v0.1 tagger Marek Prochera <marek.prochera@gmail.com> 1205624655 this is my v0.1 tag Git / Object database / Tag tag [content size]0 tag : 0c819c zlib::deflate http://alblue.bandlem.com/2011/04/git-tip-of-week-tags.html
  38. 38. Git / Object database blob tree immutable! fuck yea! commit tag
  39. 39. Git / References .git config file hooks index object database references
  40. 40. References lightweight, movable pointers to a commit stored in .git/refs/* as file Git / References HEAD blob commit branch tree tagremote
  41. 41. Git / Object db + Refs / Use case git checkout v.01 .git/refs/tags/v0.1 "0c819c" tag: 0c819c commit : a11bef tree : 1a738d README blob : a874b7
  42. 42. Git / References commit history branching and merging remotes ...
  43. 43. Git / Treeish alternate ways to refer to objects or ranges of objects • full sha-1 • partial sha-1 • branch or tag name • date spec • ordinal spec • carrot parent • tilde spec • tree pointer • blob spec • ranges
  44. 44. Git / Treeish / Full sha-1 6e453f523fa1da50ecb04431101112b3611c6a4d
  45. 45. Git / Treeish / Partial sha-1 6e453f523fa1da50ecb04431101112b3611c6a4d 6e453f523fa1da50 6e453
  46. 46. Git / Treeish / Branch, remote, tag v1.0 master origin/kuciap
  47. 47. Git / Treeish / Ordinal Spec master@{5} 5th prior value of ‘master’
  48. 48. Git / Treeish / Tidle Spec master~2 2nd generation grandparent of ‘master’
  49. 49. Git / Treeish / Tree Pointer master^{tree} tree that ‘master’ points to
  50. 50. Git / Treeish / Blob spec master:/path/to/file blob of that file in ‘master’ commit
  51. 51. Git / Treeish / Ranges ce0e4..e4272 everything between two commits
  52. 52. Git / Index .git config file hooks index object database references
  53. 53. Git / Index working directory repository index git add ... git commit ... http://alblue.bandlem.com/2011/10/git-tip-of-week-understanding-index.html
  54. 54. Git / Hooks .git config file hooks index object database references
  55. 55. hooks = automation :) fuck yea! Git / Hooks
  56. 56. Git / Config .git config file hooks index object database references
  57. 57. config = config :) Git / Config
  58. 58. Over 152 commands 42 porcelain 110 plumbing Git / Git Playground
  59. 59. Git / ID git config --global user.name “Marek Prochera” git config --global user.email “marek.prochera@gmail.com” mpr:~ marek$ cat ~/.gitconfig [user] name = Marek Prochera email = marek.prochera@gmail.com
  60. 60. Git / Clone mpr:tmp marek$ git clone git@github.com:playframework/Play20.git Cloning into 'Play20'... remote: Counting objects: 43846, done. remote: Compressing objects: 100% (17930/17930), done. remote: Total 43846 (delta 22410), reused 40397 (delta 19382) Receiving objects: 100% (43846/43846), 57.74 MiB | 3.41 MiB/s, done. Resolving deltas: 100% (22410/22410), done.
  61. 61. Git / and so on... git init git add -A git commit -a -m "Initial commit" git status git log git log --pretty=oneline git log --pretty=format: %h %an %ar - %s git diff (treeish1) (treeish2)
  62. 62. Git / and so on... git branch git show-branch git checkout -b feature git merge fature git rebase
  63. 63. Git / Merge & rebase develop master C 0 C 7 C 3 C 6 C 4 C 5 develop master C 0 C 6'C 3 C 4 C 5
  64. 64. Git / and so on... mpr:test2 marek$ git remote add krogulec git@github.com: playframework/Play20.git mpr:test2 marek$ git remote -v krogulec git@github.com:playframework/Play20.git (fetch) krogulec git@github.com:playframework/Play20.git (push)
  65. 65. Git / and so on... git remote show krogulec push / pull krogulec master pull = fetch + merge
  66. 66. no more scm document! Git / Workflows
  67. 67. Git / Repo model / Shared shared repository dev 2dev 1
  68. 68. Git / Workflows shared repository dev 2dev 1
  69. 69. Git / Repo ... / dictator and lieutenants blessed repository dev 2 dev 1 lieutenants dictator lieutenants
  70. 70. Git / Repo ... / Integration manager blessed repository dev 2 dev 1 dev 1 public repo integration manager dev 2 public repo
  71. 71. Git / Git-Flow
  72. 72. Git / Git-Flow http://nvie.com/posts/a-successful-git-branching-model/ https://github.com/nvie/gitflow ...... git flow release git flow release start <release> [<base>] git flow release finish <release>
  73. 73. Git / Repos Provider Git Mercurial Free Priv Rep Premium github bitbucket X X !!! X X X your own EC2 !!! !!!!!! !!! http://www.wikivs.com/wiki/Git_vs_Mercurial#Hosting_Provider_Support
  74. 74. Git / Git as a SVN client git as a client: do not mess in history ! sudo apt-get install git-svn git svn init svn://repo.path/trunk git svn fetch -r HEAD pull: git svn rebase push: git svn dcommit http://trac.parrot.org/parrot/wiki/git-svn-tutorial
  75. 75. Git / Tools/IDE support
  76. 76. Git / Tools/IDE support / Git alias #make "com" alias for "commit" git config alias.com commit #make "co" alias for checkout git config alias.co checkout #make "br" alias for branch git config alias.br branch # When you want to see just the differences of one function in one file in two different commits git config alias.funcdiff '!sh -c "git show "$1:$3" | sed -n "/^[^ t].*$4(/,/^}/p" > .tmp1 && git show "$2:$3" | sed -n "/^[^ t].*$4(/,/^}/p" > .tmp2 && git diff --no-index .tmp1 .tmp2"' -
  77. 77. Git / Tools/IDE support / bash https://github.com/magicmonty/bash-git-prompt
  78. 78. Git / Tools/IDE support Repository management (ssh keys, privileges ): gitosis https://wiki.archlinux.org/index.php/Gitosis Web based browsers: https://wiki.archlinux.org/index.php/Gitweb Browser + code review: https://code.google.com/p/gerrit/ http://www.codebrag.com/
  79. 79. Git / Tools/IDE support IntelliJ IDEA as always the best :) egit in eclipse sucks most of good GUI tools for git are dedicated for Mac OSX :/ http://git-scm.com/downloads/guis linux gitk / gitg (http://git.gnome.org/browse/gitg)
  80. 80. Git / Tools/IDE support IntelliJ IDEA as always the best :) egit in eclipse sucks most of good GUI tools for git are dedicated for Mac OSX :/ http://git-scm.com/downloads/guis linux gitk / gitg (http://git.gnome.org/browse/gitg)
  81. 81. Git / Tools/IDE support but if you like ponies ... you're lucky! SourceTree @ Atlassian http://www.atlassian.com/software/sourcetree/overview Git Bash!
  82. 82. Git / Git vs Hg If you just give them a chance.... http://felipec.wordpress.com/2012/05/26/no-mercurial-branches-are-still-not-better-than-git-ones-response-to-jhws-more-on- mercurial-vs-git-with-graphs/
  83. 83. Git / Resources https://www.google.com/search?q=git http://alblue.bandlem.com/Tag/git/ http://gitref.org/ ProGit (EN/PL) http://git-scm.com/ Git. Rozproszony system kontroli wersji (PL) http://helion.pl/ksiazki/git-rozproszony-system-kontroli-wersji-wlodzimierz-gajda,gitroz.htm http://pcottle.github.io/learnGitBranching/
  84. 84. Git / This is the end Thank you

×