Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Git introduction

845 views

Published on

This talk introduces the Git Version Control System by looking at what Git is doing when you run the commands you need to do basic version control with it. We'll look at how to use Git to do the basics, while seeing how it differs from Subversion, what staging and committing actually looks like, how it stores it's data, how it branches and merges so nicely and how it talks to a server when pushing and fetching. Then we'll look at how to look at your history with log in interesting ways.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Git introduction

  1. 1. Git Introduction @d_danailov
  2. 2. Git Introduction Dimitar Danailov Senior Developer at 158ltd.com dimityr.danailov[at]gmail.com Slideshare.net Github YouTube Founder at VarnaIT
  3. 3. Topics Today ● What is Git ? ● Git Init ● Git Branches ● Git Merging ● Git Conflicts
  4. 4. What is Git ?
  5. 5. Git is an open source, distributed version control system designed for speed and efficiency
  6. 6. Git is an open source, distributed version control system designed for speed and efficiency
  7. 7. Git is an open source, distributed version control system designed for speed and efficiency
  8. 8. Centralized source control vs distributed version control
  9. 9. Centralized source control
  10. 10. Computer A Checkout File Central VSC Server Version Database Version 3 Version 2 Version 1
  11. 11. Computer A Checkout File Central VSC Server Version Database Version 3 Version 2 Version 1 Computer B Checkout File
  12. 12. distributed version control
  13. 13. Computer B Version Database Computer A Version Database Version 3 Version 2 Version 1 Version 1 Version 2 Version 3 Server Computer Version Database Version 3 Version 2 Version 1
  14. 14. Fully Distributed
  15. 15. (almost) everything is local
  16. 16. git log
  17. 17. git status
  18. 18. Git Configurations
  19. 19. git config --global user.name “My Name”
  20. 20. git config --global user.email “myemail@example.com”
  21. 21. git config --global color.ui true
  22. 22. Create an empty Git repository
  23. 23. git init
  24. 24. touch hello_world.rb git add hello_world.rb git commit
  25. 25. Git Clone
  26. 26. git clone https://github.com/git/git
  27. 27. Edit files vim / emacs / etc Stage the changes git add (file) Review your changes git status / git diff Commit the changes git commit A Basic Workflow
  28. 28. Git Version Number
  29. 29. Git Branching
  30. 30. lightweight, movable pointers to a commit Branch C1
  31. 31. Snapshot
  32. 32. git checkout -b [branch_name]
  33. 33. git branch
  34. 34. git checkout [branch_name]
  35. 35. git diff
  36. 36. git merge [branch_name]
  37. 37. Master Commit fb4d2f8
  38. 38. Master Commit fb4d2f8 Head Head is pointer to current branch
  39. 39. Head git branch i18n Master fb4d2f8
  40. 40. Head git branch i18n Master i18n fb4d2f8
  41. 41. Head git branch i18n Master i18n fb4d2f8 $ git branch * master * i18n
  42. 42. git branch i18n fb4d2f8 Head i18n $ git branch * master * i18n Master
  43. 43. git commit fb4d2f8 Head i18n Master e1c6bf1
  44. 44. git commit fb4d2f8 Head i18n Master e1c6bf1
  45. 45. git checkout -b iss53 master fb4d2f8 Master e1c6bf1 Head i18n 32ac6d1
  46. 46. git checkout master; git checkout -b iss53 fb4d2f8 Master e1c6bf1 i18n 32ac6d1 Head iss53
  47. 47. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git commit
  48. 48. Merging
  49. 49. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53 Head git checkout master
  50. 50. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53 Head git merge iss53
  51. 51. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53 Head git checkout master
  52. 52. Snapshot
  53. 53. fast-forward merge
  54. 54. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge iss53
  55. 55. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge i18n
  56. 56. non fast-forward merge
  57. 57. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge i18n We need a new tree
  58. 58. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge i18n Lock History and find best merge base
  59. 59. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge i18n c3d Readme.tx f13 Hello.c c3d Readme.tx 9ec Hello.c 3ab i18n.c c3d Readme.tx f13 Hello.c 5ff issue.c
  60. 60. fb4d2f8 Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge i18n c3d Readme.tx f13 Hello.c c3d Readme.tx 9ec Hello.c 3ab i18n.c c3d Readme.tx f13 Hello.c 5ff issue.c
  61. 61. Master e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 iss53Head git merge i18n c3d Readme.tx 9ec Hello.c 3ab i18n.c c3d Readme.tx f13 Hello.c 5ff issue.c fb4d2f8c3d Readme.tx f13 Hello.c fb4d2f8c3d Readme.tx 9ec Hello.c 5ff issue.c 3ab i18n.c
  62. 62. iss53 e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 master git merge i18n c3d Readme.tx 9ec Hello.c 3ab i18n.c c3d Readme.tx f13 Hello.c 5ff issue.c fb4d2f8c3d Readme.tx f13 Hello.c fb4d2f8c3d Readme.tx 9ec Hello.c 5ff issue.c 3ab i18n.c Head
  63. 63. iss53 e1c6bf1 i18n 32ac6d1 k134ab1 a18cea1 master git merge i18n fb4d2f8 954cba1 Head
  64. 64. ● https://www.youtube.com/watch?v=ZDR433b0HJY&list=PLH2J_JZ4HZUtsholk1M9tQintjo-4rV8j ● http://git-scm.com/ ● http://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
  65. 65. Questions Dimitar Danailov Senior Developer at 158ltd.com dimityr.danailov[at]gmail.com Slideshare.net Github YouTube Founder at VarnaIT

×