Git It


Published on

Quick presentation given a bunch of weeks ago fro our predocs primer.

It's very basic overview of git, with some nice links at the end.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Git It

  1. 1. Git It! Michele @mattions
  2. 2. <1>
  3. 3. My ideal version control system● Fast● Flexible● Offline● Smart
  4. 4. CVS/SVN● CVS: – I never used CVS. Im too young.● SVN: – I cant commit locally – I cant branch as I wish – The Merging just doesnt work. – All the operation are on-line. (No connection no cookies)
  5. 5. Bazaar● Good things: – No network needed – Really cool way to export your code in a tarball● Problems: – SVN interface didnt work properly – Branching and merging is ok but not as fast as git.
  6. 6. What is Git?Git is an opensource distributed verson control system which makes you happy.
  7. 7. Hey, but I work alone!● Do you develop in linear fashon?● Do you usually make a massive commit and then you cant track what you had really changed?
  8. 8. Or... I have just a bunch of files● Dont you change them quite often?● Dont you need to keep track of what is going on?● ...
  9. 9. </1>
  10. 10. <2>
  11. 11. Different Way of thinking: Delta Storage
  12. 12. Local Rules: With No Network you can:● Performing a diff● Viewing file history● Committing changes● Merging branches● Obtaining any other revision of a file● Switching branches
  13. 13. Non Linear Development: Try your ideas
  14. 14. Freedom!!!!
  15. 15. You can move around a lot of branches and try different things$ git checkout -b feature_x#hack #hack$ git commit -am ”Adding new feature_x”$ git checkout master$ git merge feature_x Its fast You retain control
  16. 16. </2>
  17. 17. <3>
  18. 18. Basic use: git init – Init a new repositorygit add file1-- Add file1 to the repogit commit -m ”My first initial commit” -- Commit
  19. 19. Stage Idea
  20. 20. add a file you dont commit it but you put it in the index
  21. 21. If you just add a file this is staged but not committed
  22. 22. Commit: You commit everything that you have added
  23. 23. When you commit the file is recorded in the repo.
  24. 24. Scenario File1 -- Correct a typoFile2 -- introduced a new methodFile3 -- Introduced new method
  25. 25. Control gives you flexibility$ git add file1$ git commit -m ”corrected a typo.”$ git add file2 file3$ git commit -m ”Introduced the newfeature to land on the moon.”
  26. 26. Mantra: Small commit are goodDo a lot of commit and divide your change logically in small part. It will help you a lot when you will break everything (and you will...)
  27. 27. -a switchgit commit -am ”I commit all 3 files in one go.”
  28. 28. </3>
  29. 29. <4>
  30. 30. Working online$ git push origin master$ git pull origin masterCan be any branch$ git push origin feature_x
  31. 31.
  32. 32. Github is just good
  33. 33. Easy docs for your project hosted automatically
  34. 34. Nice way to collaborate
  35. 35. </4>
  36. 36. Bonus info#git branchparse_git_branch() {git branch 2> /dev/null | sed -e /^[^*]/d -e s/* (.*)/(1)/}#greyPS1=[33[0;32m]u[33[1;32m]@ [33[0;32m]h[33[00m]: [33[01;34m]W[33[1;30m]$ (parse_git_branch)[33[00m]$
  37. 37. Results
  38. 38. Useful resources: Git Github Nice guide my profile Some of the slides were taken from Scott Chacon