Git tutorial

503 views
412 views

Published on

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

No Downloads
Views
Total views
503
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Git tutorial

  1. 1. + Distributed Version Control Nuttapon Pattanavijit
  2. 2. Reference • http://git-scm.com • https://www.atlassian.com/git/tutorial
  3. 3. 1. WTF is Version Control ?
  4. 4. Collaboration
  5. 5. If someone blow up your code! what will you do if you use something like dropbox?
  6. 6. Snapshot sounds good
  7. 7. Snapshot sounds good?
  8. 8. Local Version Control
  9. 9. Centralized Version Control Systems
  10. 10. Distributed Version Control System git is DVCS
  11. 11. 2. Git?
  12. 12. History of Git • Developed for Linux Kernel project. • Speed, Simple design • Non-linear development • Fully distributed • Able to handle large projects
  13. 13. Snapshot of project over time basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. To be efficient, if files have not changed, Git doesn’t store the file again—just a link to the previous identical file it has already stored.
  14. 14. Git workflow 1. You modify files in your working directory. 2. You stage the files, adding snapshots of them to your staging area. 3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
  15. 15. 3. Git Basic
  16. 16. Git Basic git init initializes new repository git clone create a copy
  17. 17. Git Basic
  18. 18. Git Basic git add add files to staging git commit snapshot project
  19. 19. 4. Undoing changes
  20. 20. Undoing Changes git checkout previous version git revert undo committed snapshot git reset undo changes in working directory
  21. 21. 5. Branching
  22. 22. git branch testing
  23. 23. git checkout testing
  24. 24. git commit -a -m “made a change”
  25. 25. git checkout master
  26. 26. git commit -a -m “made other changes”
  27. 27. 6. Merging
  28. 28. git checkout master git merge iss53
  29. 29. git checkout master git merge iss53
  30. 30. If two branches edit same file? How to handle merge conflict?
  31. 31. 7. Remote Repositories
  32. 32. Demo
  33. 33. Remote Repositories git pull fetch + merge into current branch git push update local repo to remote repo
  34. 34. 8. Feature Branch Workflow
  35. 35. git checkout -b my_feature master = git checkout master git branch my_feature
  36. 36. git push -u origin master
  37. 37. git pull
  38. 38. git push -u origin my_feature git checkout master git pull git merge my_feature git push

×