Git introduction

1,352 views

Published on

I was presenting an introduction to Git at Szegedtech

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,352
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
16
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Git introduction

  1. 1. GitKornel Lugosi @CoornailMay 17, 2011
  2. 2. Table of contentsVersion controlDistributed revision controlRepositoryAdding, commitingTracking changesBranchesPushing, pullingSubmodulesRanges and other identifications of hashesOther fun stuffResources
  3. 3. Version control What?
  4. 4. Version control Why?
  5. 5. Version control Why?◮ Backup
  6. 6. Version control Why?◮ Backup◮ Revision handling
  7. 7. Version control Why?◮ Backup◮ Revision handling◮ Teamwork
  8. 8. Version control Why?◮ Backup◮ Revision handling◮ Teamwork◮ Organized code commit access and workflow
  9. 9. Version control Why?◮ Backup◮ Revision handling◮ Teamwork◮ Organized code commit access and workflow◮ Deploying
  10. 10. Version control How?
  11. 11. Version control How?◮ CVS
  12. 12. Version control How?◮ CVS◮ SVN
  13. 13. Version control How?◮ CVS◮ SVN◮ Hg(Mercurial)
  14. 14. Version control How?◮ CVS◮ SVN◮ Hg(Mercurial)◮ bzr (Bazaar)
  15. 15. Version control How?◮ CVS◮ SVN◮ Hg(Mercurial)◮ bzr (Bazaar)◮ ...
  16. 16. Version control How?◮ CVS◮ SVN◮ Hg(Mercurial)◮ bzr (Bazaar)◮ ...◮ Git
  17. 17. Distributed revision control
  18. 18. Repository(Repo)
  19. 19. Repository$ git init
  20. 20. Repository$ git init$ git init --bare
  21. 21. Repository$ git init$ git init --bare$ git init --bare --shared=group
  22. 22. Let’s put some code in!$ echo "some code" > index.php$ git add index.php
  23. 23. Let’s put some code in!$ echo "some code" > index.php$ git add index.phpOh shit, it is only added to the “index“!
  24. 24. Let’s put some code in!$ echo "some code" > index.php$ git add index.phpOh shit, it is only added to the “index“!Well, fuck that!$ git commit -m "My first commit"
  25. 25. Let’s put some code in!$ echo "some code" > index.php$ git add index.phpOh shit, it is only added to the “index“!Well, fuck that!$ git commit -m "My first commit"But it is not on the remote server yet!$ git push ...
  26. 26. Nobody is looking, let’s commit everything!$ cat > index.php<?php Thousand lines of code...ˆD$ git commit -a
  27. 27. What the hell did I do? (in the working tree)$ git diff
  28. 28. What the hell did I do a year ago?$ git log
  29. 29. I have no idea what I do Let’s not show it to everyone (yet)!$ git branch experimental$ git checkout experimental
  30. 30. What branch am I on?$ git branch -a
  31. 31. Turns out I am smart after all$ git checkout master$ git merge experimental
  32. 32. I was smart todayLet’s show it to everyone$ git push <repository> <refspec>
  33. 33. I was smart today Let’s show it to everyone$ git push <repository> <refspec>Damn! Somebody was faster...Conflict =(
  34. 34. My code, let me show it to you!$ git clone <repository>
  35. 35. My code, let me show it to you!$ git clone <repository>Okay, I already have you repo, I want to laugh atyour code!boss$ git pull <repository>
  36. 36. Tagging$ git tag
  37. 37. Submodules
  38. 38. Submodules$ git submodule add <repository> <path>
  39. 39. Submodules$ git submodule add <repository> <path> From the root directory!
  40. 40. Ranges$ git log 0af56ffa..HEAD
  41. 41. Ranges$ git log 0af56ffa..HEAD$ git diff v2.5..HEADˆ
  42. 42. Ranges$ git log 0af56ffa..HEAD$ git diff v2.5..HEADˆ$ git cherry-pick HEAD˜4..
  43. 43. Other fun stuff◮ $ git revert◮ $ git reset◮ $ git stash◮ $ git bisect◮ $ git rebase◮ $ git gc
  44. 44. Links◮ Official git documentation◮ github◮ Git Cheat sheet

×