Intro To Git

5,977 views
5,791 views

Published on

Source Code Management and Version Control Systems are tools for helping you track your file based assets (typically source code). Traditional SCM systems are centralised (CVS, Subversion, Visual Source Safe), Distributed version control systems systems provide new capabilities, work-flows, are becoming mature and are gaining mind share in the open source community.

Git is one of those Distributed Version Control Systems. It was invented by the creator of Linux (Linus Torvalds) for protecting the Linux kernel source code and coordinating the activity of hundreds of developers. This talk discusses what Distributed Version Control is, the history of Git, basic version control features and some very uncommon and amazing capabilities of git. Time permitting it will include live demonstration of the tools.

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

No Downloads
Views
Total views
5,977
On SlideShare
0
From Embeds
0
Number of Embeds
414
Actions
Shares
0
Downloads
188
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Intro To Git

  1. 1. Introducing: git Level up your VCS [PLUG / May 6th 2009] Wednesday, May 6, 2009
  2. 2. About Your Presenter • Director of Architecture at HMS • Open Source Groupie • cpan, advocacy (this talk) • http://asymmetrical-view.com/ Wednesday, May 6, 2009
  3. 3. Health Market Science • HCP Demographic Info • Compliance • Data Integration Services • OpenHMS • We Hiring! • Devs [Perl, Java], UI / UX, BA, PM Wednesday, May 6, 2009
  4. 4. Not Covering • Git vs Other VCSs • Hg/Mercurial, Darcs, etc. • Installation • Full Tutorial • http://www.gitready.com/ Wednesday, May 6, 2009
  5. 5. The Journey • SCM • History • Git • Demonstration Wednesday, May 6, 2009
  6. 6. SCM in a Nutshell Software Configuration Management Source Code Management Protect and Track File Based Assets Wednesday, May 6, 2009
  7. 7. Fundamentals of VCS Initialize Add Files Commit View History Share Update Revert Branch Wednesday, May 6, 2009
  8. 8. VCS: Two Major Types Centralized CVS, SVN, Most Commercial Offerings Distributed Git, Darcs, Hg, Bazar, BitKeeper Wednesday, May 6, 2009
  9. 9. The Journey • SCM • History • Git • Demonstration Wednesday, May 6, 2009
  10. 10. In the beginning... Linus used no VCS for the Linux Kernel (!) “Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it ;) “ – Linus BitKeeper first tried out by LinuxPPC project Linus Adopts it “Best tool for the job” Linus starts using a VCS in Feb 2002 (rejoice!) Wednesday, May 6, 2009
  11. 11. The Plot Thickens BitKeeper by BitMover Free use for Open Source …so long as you don’t work on another DVCS …or reverse engineer the wire protocol In steps Andrew Tridgell telnet bkserver bkport help^M Wednesday, May 6, 2009
  12. 12. The Plot Thickens BitKeeper by BitMover Free use for Open Source …so long as you don’t work on another DVCS …or reverse engineer the wire protocol In steps Andrew Tridgell telnet bkserver bkport help^M Revoked Wednesday, May 6, 2009
  13. 13. A git is born In Steps Linus Torvalds • Opinionated • Needed DVCS • Safeguards against corruption • High Performance (impatience is a virtue) Started: 2005/04/03 Announced: 2005/04/06 Self Hosting: 2005/04/07 (4d!) First Multi-branch Merge: 2005/04/18 (15d!) Wednesday, May 6, 2009
  14. 14. The Journey • SCM • History • Git • Demonstration Wednesday, May 6, 2009
  15. 15. “I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git[1].” Linus Torvalds “I have an ego the size of a small planet” - Linus  [1] git (n): British slang for a stupid or unpleasant person Wednesday, May 6, 2009
  16. 16. Not like the other VCSs Tracks Content via SHA-1 hash Working Area Index (Staging Area) Repositories (http, ssh, local, nfs, git) Stash Wednesday, May 6, 2009
  17. 17. diff HEAD diff diff --cached commit -u add commit push Working Local Remote Index Directory Repository Repository stash Stash clone, pull fetch rm --cached merge, checkout Wednesday, May 6, 2009
  18. 18. Stand Alone... Wednesday, May 6, 2009
  19. 19. Collaborate... Wednesday, May 6, 2009
  20. 20. git-svn git svn clone (Gateway Drug) git svn dcommit git svn rebase (svn duplicates a lot of data, this makes the initial clone slow, but you only pay once) Wednesday, May 6, 2009
  21. 21. Branching: Actually Useful CVS Branching: sucks SVN Branching: sucks GIT Branching: FTW! Wednesday, May 6, 2009
  22. 22. Tools and Features gitk git log --color --graph .git/info/exclude and .gitignore git grep ‘java.util.Map’ $(git tag -l) Relative Versions git diff HEAD^ git diff HEAD^^^^^ git diff HEAD~5 HEAD~10 Wednesday, May 6, 2009
  23. 23. Tools and Features git blame <<file>> git clean git bisect git add --interactive git archive --prefix=java-memcached-client --format=tar 2.3 | gzip > java-memcached-client-2.3.tgz git gui git instaweb Wednesday, May 6, 2009
  24. 24. The Journey • SCM • History • Git • Demonstration Wednesday, May 6, 2009
  25. 25. Demonstration (run off to a terminal, don’t forget to start X, try not to make [too much of] a fool of yourself) Wednesday, May 6, 2009
  26. 26. Should You Adopt Git? NO! You just moved to {svn,Hg,darcs,*} People Don’t like Change Some Tools Still Immature (honestly I couldn’t come up with any technical reasons) Wednesday, May 6, 2009
  27. 27. Should You Adopt Git? YES! Fantastic for local use $HOME and /etc git-svn It’s fast Happy Developers == more productive (if you buy into that sort of thing) Wednesday, May 6, 2009
  28. 28. Conclusion Fast Geek Chic DVCS Different Powerful Easier Than it seems (did I mention it’s fast?) Wednesday, May 6, 2009
  29. 29. kyle@ppt:~ $ git commit –a –m ‘finished presentation’ [detached HEAD a835269] finished presentations 2 files changed, 3 insertions(+), 3 deletions(-) kyle@ppt:~ $ git push Counting objects: 5, done. Delta compression using 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 297 bytes, done. Total 3 (delta 2), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. To /home/git-repo/git-presentation/ 3fd2b39..867372e master -> master kyle@ppt:~ $ ^D Wednesday, May 6, 2009
  30. 30. References http://www.youtube.com/watch?v=4XpnKHJAok8 http://www.gitready.com/ http://en.wikipedia.org/wiki/Git_(software) http://git-scm.com/ http://git.or.cz/index http://git.kernel.org/ http://kerneltrap.org/node/4966 http://jbowes.wordpress.com/2007/02/18/git-bisect-a-practical-example-with-yum/ http://github.com/bobmcwhirter/jboss-messaging/tree/master http://www.reddit.com/r/programming/comments/80xax/sourceforge_now_supports_git/ http://www.advogato.org/person/apenwarr/diary/371.html http://maven.apache.org/scm/git.html http://code.google.com/p/tortoisegit/ http://osteele.com/archives/2008/05/my-git-workflow http://confluence.atlassian.com/display/CRUCIBLE/Crucible+Git+Plugin http://code.google.com/p/msysgit/ Wednesday, May 6, 2009
  31. 31. Photo Credits http://www.flickr.com/photos/teducation/2592566840/ http://www.flickr.com/photos/leecullivan/2868458125/ http://www.flickr.com/photos/shaylor/21315572/ http://www.flickr.com/photos/maxboss/76337059/ http://www.flickr.com/photos/ogimogi/2253657555/ http://www.flickr.com/photos/22863752@N06/2378924202/ http://www.flickr.com/photos/ianhampton/65178598/ http://www.flickr.com/photos/travalicando/381993996/ http://www.flickr.com/photos/29007475@N08/3078319536/ http://www.flickr.com/photos/devnull/359791913/ http://www.flickr.com/photos/theducks/2234788198/ Wednesday, May 6, 2009

×