Git presentation, Viktor Pyskunov

849 views

Published on

Introducing Git Principles and How-To Use

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
849
On SlideShare
0
From Embeds
0
Number of Embeds
71
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Git presentation, Viktor Pyskunov

  1. 1. Git Distributed Version Control System by Viktor Pyskunov
  2. 2. About• Created by Linus Torvalds, author of Linux• Very fast• Used in Linux kernel development• Makes working with branches really fun• Better conflict resolution• Working offline• There are no hundreds of .svn directories all over the code, instead only one .git directory in the root of project• Comfortable to work with commits
  3. 3. Git design objectives• Distributed • No central repo • Everyone is on her own island• Performance • Branching and merge is cheap • Diff the whole kernel tree in less than 1 second • Store the KDE tree in less than 2GB while SVN takes 8GB
  4. 4. SVN Way• Commit concurrency• Slow history• Unstaged changes that may be lost due to conflicts
  5. 5. Git Way• Every developer has their own repo• Fast history as well as commits• A lot of local commits before pushing• Code staging decreases possibility of data loss
  6. 6. Git Entities• Working directory• Index, or staging• Local repository• Remote repository
  7. 7. Git Commands Dealing with Entities
  8. 8. Generate ssh KeyClick on Start->Programs->TortoiseGit->PuttyGenGenerateSave private key Console: ssh-keygen
  9. 9. Generate ssh KeyDon’t close the windowSave this key somewhereStart->Programs->TortoiseGit->Pageant
  10. 10. Typical Git Workflow• Pull from remote repository• Edit files• Add• Commit• Edit files again together with new ones• Add• Commit• Push to remote repository
  11. 11. Typical Git Workflow Visualized
  12. 12. Extended Git Workflow• Pull from remote repository• Create new branch from common branch• Edit files• Add• Commit• Edit files again together with new ones• Add• Commit• Merge your working branch to common branch• Resolve conflicts• Delete working branch• Push to remote repository
  13. 13. Tortoise Git
  14. 14. Cloning Repository Console: git clone <path_to_repository>
  15. 15. Initial Repository
  16. 16. History Console: git log
  17. 17. Adding new file Console: git add <file1> <file2> …
  18. 18. Committing Changes Console: git commit <file1> <file2> …
  19. 19. History with New Commit
  20. 20. New Branch with the Third File Console: git branch <name_of_branch>
  21. 21. Adding File
  22. 22. Committing File in Branch
  23. 23. Switching to Master Console: git checkout <name_of_branch>
  24. 24. Merge from Branch to Master Console: git merge <name_of_branch>
  25. 25. Master After Merge
  26. 26. Branches After Merge
  27. 27. Push Your Modifications Checkbox will push all your branches If unchecked, only selected branches will be pushed Console: git push <repository> <branch>
  28. 28. Fetch with rebase Using fetch with rebase instead of pull will flatten history of commits to make it sequential Console: git pull --rebase
  29. 29. Reverting Commit Console: git revert <hash_of_commit>
  30. 30. References• Book http://progit.org/book/• Tools http://guides.beanstalkapp.com/version- control/clients.html

×