Magie di git

950 views

Published on

Introduzione a git - talk tenuto al meeting del JUG Padova 18 ottobre 2008

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

  • Be the first to like this

No Downloads
Views
Total views
950
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Magie di git

  1. 1. Magie di„ …any sufficiently advanced technology is indistinguishable from magic. “ Arthur C. Clarke
  2. 2. termine gergale britannicoper indicare una persona stupida o sgradevole.
  3. 3. „ Sono un egoista bastardo, e do a tutti i miei progetti un nome che mi riguardi.Prima Linux, adesso Git “ Linus Torvard
  4. 4. open source version control system designedto handle very large projects with speed andefficiency. ● non-linear development ● distributed development ● HTTP, FTP, ssh, rsync, or a Git protocol ● cryptographic authentication ● toolkit design ● pluggable merge strategies
  5. 5. http://www.flickr.com/photos/mewerts/
  6. 6. Installation Windows - msysGit http://code.google.com/p/msysgit/ OS X Leopard - Git OS X Installerhttp://code.google.com/p/git-osx-installer/ Linux - apt-get/yum install git-core
  7. 7. http://www.flickr.com/photos/velkr0/
  8. 8. Setup & Initialization setting a few global variables:git config --global user.name “michele franzin“git config --global user.email michele@franzin.netgit config --global color.status autogit config --global color.branch auto create a git repository in the current project directory:git initgit add .git commit -m "initial commit of project"
  9. 9. Basic Workflow make some changes, review what you have done, stage (add) those changes, commit# make some changes to README.txtgit statusgit diffgit add README.txtgit commit -m "updated the description" make some BAD changes, revert to the last state# make some bad changes to config/hoe.rbgit statusgit reset --hard HEAD #NOT -> git revert HEAD
  10. 10. IgnoringProject Global - edit the .git/info/exclude filePer Directory - put it in a .gitignore file
  11. 11. Exploring history exploring commit messagesgit loggit log --since="2008-05-20"git log --since="1 week ago" --until="2 days ago"git log path/to/filegit log -p show commit detailsgit show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
  12. 12. Simple Branching and Merging# write a Hello World program tmp/hw.rbgit add tmp/hw.rbgit commit -m "hello commit"git checkout -b refactor# refactor out our putsgit commit -a -m "refactored puts"git branch # lists banrchesgit checkout mastergit pull . refactor # fast forward merge
  13. 13. http://www.flickr.com/photos/26810211@N06
  14. 14. http://www.flickr.com/photos/22355750@N07/
  15. 15. Hold on!use git stash to hold onto changesconflicts are marked with “<“resolve them using git mergetoolgit add the files
  16. 16. Collaborating & Contributionsgit clone /home/alice/project myrepo(edit files)bob$ git commit -aalice$ cd /home/alice/projectalice$ git pull /home/bob/myrepo master# inspect without mergingalice$ git fetch /home/bob/myrepo masteralice$ git log -p HEAD..FETCH_HEAD
  17. 17. GITKgitk
  18. 18. Extra Hosting http://www.github.com/ Netbeans 6.0 plugin (beta)http://code.google.com/p/nbgit/ Eclipse plugin http://www.jgit.org/
  19. 19. Resources Official website http://git.or.cz/ Tutorial - http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html Guides http://github.com/guides/home Git - SVN Crash Course http://git.or.cz/course/svn.html
  20. 20. http://www.flickr.com/photos/studiomuntz
  21. 21. michele.franzin@jugpadova.it ...thank you

×