Git Going With DVCS v1.5.1
Upcoming SlideShare
Loading in...5
×
 

Git Going With DVCS v1.5.1

on

  • 3,144 views

IASA presentation of Git talk

IASA presentation of Git talk

Statistics

Views

Total Views
3,144
Views on SlideShare
3,122
Embed Views
22

Actions

Likes
1
Downloads
72
Comments
0

2 Embeds 22

http://www.mr-san.com 20
http://www.slideshare.net 2

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Git Going With DVCS v1.5.1 Git Going With DVCS v1.5.1 Presentation Transcript

  • Git going with DVCS mental spoo n bending 90 minutes of v ia source c ode control by Matthew McCullough of Ambient Ideas, LLC
  • DVCS
  • What? Why? Basic Use DVCS
  • What? Why? Basic Use Who’s Theory DVCS Using Git? Deeper Use
  • What? Why? Basic Use Who’s Theory DVCS Using Git? Deeper Use Usage Models GUIs High Points
  • “ Git -noun sant or Slang. an unplea British cont emptible per son ” ionar y -Oxfo rd English Dict
  • contrasts
  • otistical bastard, and “ I'm an eg I name all my projects after myself. Fi rst Linux, now git. ” -Lin us Torvalds
  • otistical bastard, and “ I'm an eg I name all my projects after myself. Fi rst Linux, now git. ” -Lin us Torvalds
  • RCS Folders
  • Clear Source Case Safe CVS PVCS RCS Folders
  • Subversion BitKeeper Perforce Clear Source Case Safe CVS PVCS RCS Folders
  • darcs Mercurial Bazaar Subversion BitKeeper Perforce Clear Source Case Safe CVS PVCS RCS Folders
  • t Source Code Control Gi
  • Gi Source Code Control t
  • CultureChange
  • Centralized VCS =Don’t
  • Centralized VCS =Don’t
  • Distributed VCS = Whatever! Do
  • Innovate
  • Experiment
  • Safely Be Wrong
  • Drive-by Assist
  • Crowd Source
  • Crowd Source
  • Crowd Source
  • Just show it to me!
  • No, not on that!
  • Download binaries
  • Git Distro Sources Win Cygwin Win msysGit
  • Git Distro Sources Win Cygwin Win msysGit Linux Source Linux Package manager
  • Git Distro Sources Win Cygwin Win msysGit Linux Source Linux Package manager Mac MacPorts Mac git-osx-installer
  • Git Distro Sources Win Cygwin Win msysGit Linux Source Linux Package manager Mac MacPorts Mac git-osx-installer Any JGit
  • Put it in your path
  • Identify yourself
  • Global Git Settings git config --global user.name quot;Hal Smithquot; git config --global user.email quot;hal@bnl.comquot;
  • Global Git Settings git config --list
  • Global Git Settings git config --list t va lues t cu rren Outpu
  • Use it!
  • Creating a Repo mkdir myproj.git
  • Creating a Repo mkdir myproj.git cd myproj.git
  • Creating a Repo mkdir myproj.git cd myproj.git git init
  • Creating a Repo ! mkdir myproj.git D O N E cd myproj.git git init
  • Thanks for attending!
  • Knobs and Dials
  • 145+ Commands
  • What? Why? Basic Use Who’s Theory DVCS Using Git? Deeper Use Usage Models GUIs High Points
  • Who’s Got Git?
  • Follow the DOTS
  • Symmetric
  • Symmetric
  • Distributed
  • pu sh
  • pu sh
  • push
  • push
  • pull
  • pull
  • Distributed
  • Hashes and Integrity
  • Index vs Hash ‣ Centralized VCS uses DB sequential index. ‣ Git uses SHA-1 hash.
  • SHA-1 Hash ‣ Hash for the sake of integrity. ‣ Keep the source of the hash.
  • SHA-1 Hash ‣ Hash for the sake of integrity. ‣ Keep the source of the hash. ught I tho ere es w hash r fo swo rds? pas
  • Centralized VCS
  • Alice Bob
  • Alice Bob 1 = okay.htm
  • Alice Bob 1 = okay.htm 2 = fine.htm
  • Alice Bob 1 = okay.htm 2 = fine.htm svnsync
  • Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm svnsync 2 = fine.htm
  • Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm svnsync 2 = fine.htm 3 = good.htm
  • Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm svnsync 2 = fine.htm 3 = good.htm 3 = great.htm
  • Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm svnsync 2 = fine.htm 3 = good.htm 3 = great.htm svnsync
  • Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm svnsync 2 = fine.htm 4 = good.htm 3 = good.htm 3 = great.htm svnsync 4 = great.htm
  • Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm svnsync 2 = fine.htm ERROR 4 = good.htm 3 = good.htm 3 = great.htm ERROR svnsync 4 = great.htm
  • Distributed VCS
  • Alice Bob
  • Alice Bob a233b76 = okay.htm
  • Alice Bob a233b76 = okay.htm d234ab1 = fine.htm
  • Alice Bob a233b76 = okay.htm d234ab1 = fine.htm Sync
  • Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm Sync d234ab1 = fine.htm
  • Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm Sync d234ab1 = fine.htm f90b12c = good.htm
  • Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm Sync d234ab1 = fine.htm f90b12c = good.htm ae42ba0 = great.htm
  • Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm Sync d234ab1 = fine.htm f90b12c = good.htm ae42ba0 = great.htm Sync
  • Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm Sync d234ab1 = fine.htm f90b12c = good.htm f90b12c = good.htm ae42ba0 = great.htm Sync ae42ba0 = great.htm
  • Hashable Objects ‣ Blob ‣ Tree ‣ Commit ‣ Tag
  • http://book.git-scm.com/1_the_git_object_model.html
  • http://book.git-scm.com/1_the_git_object_model.html
  • http://book.git-scm.com/1_the_git_object_model.html
  • http://book.git-scm.com/1_the_git_object_model.html
  • Hash Benefits Independence ‣ Time & location separation from sequence # of checkin. ‣ Easy merging of repositories ‣ Easy identification of what needs to be synced
  • Hash Benefits Integrity ‣ Identifies damaged repos. ‣ Prevents modification of published history. ‣ Unique to file size and contents.
  • Hash Benefits Tags ‣ Cryptographically sign tags by GPG. ‣ Guaranteeing the repo’s state at a point in time.
  • Location,Location,Location
  • Single Stage Thinking of Subversion
  • Subversion ‣ svn commit ‣ Adds everything modified. ‣ “committed” locally and on the server. ‣ Must list if you want specific files. ‣ What if you check in your password?
  • $ echo //COMMENTS >> Matt1.java $ echo //THOUGHTS >> Matt2.java
  • $ echo //COMMENTS >> Matt1.java $ echo //THOUGHTS >> Matt2.java $ svn status M Matt1.java M Matt2.java
  • $ echo //COMMENTS >> Matt1.java $ echo //THOUGHTS >> Matt2.java $ svn status M Matt1.java M Matt2.java $ svn commit -m'Matts checkin' Adding Matt1.java Adding Matt2.java Transmitting file data . Committed revision 2.
  • Three Stage Thinking of Git
  • Git ‣ git add ‣ git commit ‣ git push ‣ Commits only what is added to the index. ‣ Opportunity to change history locally. ‣ Selectively share with other repos.
  • repo git clone git://somedomain/myproj.git B uild cd myproj.git
  • repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master U
  • repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master U echo ‘//Comments’ >> ClassOne.java or king echo ‘//Thoughts’ >> ClassTwo.java E dit w
  • repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master U echo ‘//Comments’ >> ClassOne.java or king echo ‘//Thoughts’ >> ClassTwo.java E dit w to i ndex git add ClassOne.java Add epo ave to r git commit -m’Added comments’ S
  • repo git clone git://somedomain/myproj.git B uild cd myproj.git dex pda te in git checkout master U echo ‘//Comments’ >> ClassOne.java or king echo ‘//Thoughts’ >> ClassTwo.java E dit w to i ndex git add ClassOne.java Add epo ave to r git commit -m’Added comments’ S st ash git stash Pus h to
  • Remote is like a special Stash Repo Index Working
  • Remote is like a special Stash Repo Index Working
  • Remote is like a special Stash Repo git clone Index Working
  • Remote is like a special Stash Repo git clone git checkout Index Working
  • Remote is like a special Stash Repo git clone git checkout edit experiment files Index Working
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash Index Working
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash test buggy files Index Working
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash test buggy files Index git stash apply Working
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash test buggy files Index git stash apply Working git add
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash test buggy files Index git stash apply Working git add git commit
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash test buggy files Index git stash apply Working git add git commit git push
  • Remote is like a special Stash Repo git clone git checkout edit experiment files git stash test buggy files Index git stash apply Working git add git commit git push
  • What does this buy me?
  • $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt
  • $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt $ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt
  • $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt $ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt o in dex int $ git add mattfile1.txt Put
  • $ echo //MYD0GSNAM3 >> mattfile1.txt $ echo //NewText2 >> mattfile2.txt $ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt o in dex int $ git add mattfile1.txt Put to r epo S ave $ git commit -m'Matts pw checkin' [master]: created ddcdf18: quot;Matts pw checkinquot; 1 files changed, 1 insertions(+), 0 deletions(-)
  • #$%^&! I just committed my password!
  • Change History $ git reset --hard HEAD^ HEAD is now at 9de4cd3 First checkin $ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough <matthewm@ambientideas.com> Date: Wed Mar 4 23:09:17 2009 -0700 First checkin
  • Change History com mit the w a way $ git reset --hard HEAD^ T hro HEAD is now at 9de4cd3 First checkin $ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough <matthewm@ambientideas.com> Date: Wed Mar 4 23:09:17 2009 -0700 First checkin
  • Change History com mit the w a way $ git reset --hard HEAD^ T hro HEAD is now at 9de4cd3 First checkin $ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough <matthewm@ambientideas.com> Date: Wed Mar 4 23:09:17 2009 -0700 First checkin
  • Sharing
  • Serving It Up Protocols ‣ GIT ‣ SSH ‣ SCP ‣ Local file system ‣ SAMBA ‣ HTTP ‣ WebDAV ‣ rsync
  • Serving It Up Network ‣ git instaweb. Built in, read-only, HTTP. ‣ git daemon. Custom socket language. ‣ gitosis. Easy permissions control. ‣ github. Open source & private repos. ‣ ssh. OS controlled permissions.
  • Serving It Up Filesystem ‣ Local folders. Yes, they can be “remotes.” ‣ Mapped network drives. Just like folders.
  • aem on git clone git://somehost.org/myproj.git g it d
  • aem on git clone git://somehost.org/myproj.git g it d git clone mccm06@somehost.org:myproj.git SSH
  • aem on git clone git://somehost.org/myproj.git g it d git clone mccm06@somehost.org:myproj.git SSH git clone http://somehost.org/myproj.git H TTP
  • aem on git clone git://somehost.org/myproj.git g it d git clone mccm06@somehost.org:myproj.git SSH git clone http://somehost.org/myproj.git H TTP sys tem git clone ~/work/myproj.git File
  • aem on git clone git://somehost.org/myproj.git g it d git clone mccm06@somehost.org:myproj.git SSH git clone http://somehost.org/myproj.git H TTP sys tem git clone ~/work/myproj.git File rk d rive Ne two git clone z:someservermyproj.git
  • Merge & Rebase
  • Cheap Branches
  • Cheap Branches git show-branch --all git branch -a ‣Local branch ‣localbranchname ‣Remote ‣remote/branchname
  • Merge Anything
  • Merge Anything git merge --no-commit <sourcebranch> git merge --squash <sourcebranch> git merge <sourcebranch1> <sourcebranch2> ‣Selectable merge strategy ‣Octopus: More than one ‣Review before committing ‣Flatten micro-checkins
  • Rebase for Clarity
  • Rebase for Clarity git checkout myfeaturebranch git rebase master ‣Cleaner history than a merge. ‣Fast forwards original branch. ‣Lets you see “how trunk will act” before you merge. ‣Reposition your feature branch’s start point. ‣Makes for simpler merge graphs.
  • M da S er r ta g d n e Master/Trunk/MainLatest
  • M da S er r ta g d n e Master/Trunk/MainLatest a32
  • ard Bra d n e ta g a32 n ch S er Master/Trunk/MainLatest M 2e2
  • ard Bra d n e ta g a32 n ch S er Master/Trunk/MainLatest d19 M 2e2
  • ard Bra d n e ta g a32 n ch S er Master/Trunk/MainLatest d19 M 2e2 8b3
  • ard Bra d n e ta g a32 n ch S er Master/Trunk/MainLatest d19 M 2e2 e69 8b3
  • ard Bra d n e ta g a32 n ch S er Master/Trunk/MainLatest d19 M 2e2 e69 8b3 erge M 9f1
  • Rebasing Master/Trunk/MainLatest
  • Rebasing Master/Trunk/MainLatest a32
  • Rebasing Master/Trunk/MainLatest a32 2e2 Bra ch n
  • Bra sing a32 n ch ba Master/Trunk/MainLatest Re 2e2 d19
  • Bra sing a32 n ch ba Master/Trunk/MainLatest Re 2e2 d19 8b3
  • Bra sing a32 n ch ba Master/Trunk/MainLatest Re 2e2 d19 8b3 e69
  • Master/Trunk/MainLatest a32 2e2 8b3 Bra ch n d19 e69 Rebase
  • a32 Master/Trunk/MainLatest 2e2 8b3 Bra n ch d19 d19 Me rg e e69 e69
  • WorkingOffline
  • Offline Anything Checkin
  • Offline Anything Checkin Add Branch List change log Grep history Rewrite history Stash Merge Label Remove
  • Offline Anything Checkin Add Branch List change log Grep history Rewrite history Stash Merge Label Remove practically everything but push
  • Offline Anything Checkin Add Branch List change log Grep history Rewrite history Stash Merge Label Remove practically everything but push
  • Hooray! Another checkin to my latest OSS project!
  • Hooray! Another checkin to my latest OSS project! I think I liked subversion better...
  • Speed
  • git: git hg: mercurial bzr: bazaar
  • Init Add Status Diff Branch (Cold/Hot) git hg bzr git hg bzr git hg bzr git hg bzr Tag Log Commit (Lg) Commit (Sm) git c git h hg c hg h bzr c bzr h git hg bzr git hg bzr git hg bzr git hg bzr data from http://whygitisbetterthanx.com/#git-is-fast
  • 10 to 100 times Faster
  • VCS Interop
  • Subversion git svn clone http://unfurl.com/trunk git svn dcommit
  • Subversion git svn clone http://unfurl.com/trunk git svn dcommit ‣ First class compatibility.
  • Subversion git svn clone http://unfurl.com/trunk git svn dcommit ‣ First class compatibility. ‣ Round trip support.
  • Subversion git svn clone http://unfurl.com/trunk git svn dcommit ‣ First class compatibility. ‣ Round trip support. ‣ Git commits = svn commits.
  • Migration ‣ git svn clone
  • Migration ‣ git svn clone ‣ Power off your Subversion server.
  • What? Why? Basic Use Who’s Theory DVCS Using Git? Deeper Use Usage Models GUIs High Points
  • UsageModels
  • Centralized Central Repo
  • Centralized Central Repo
  • Repo Blessed Dictatorship
  • Repo Blessed Dictatorship
  • Repo Blessed Dictatorship
  • Repo Blessed Dictatorship
  • Repo Blessed Dictatorship
  • Certified Integration Managed Development Repo Repo
  • Certified Integration Managed Development Repo Repo
  • Certified Integration Managed Development Repo Repo
  • Certified Integration Managed Development Repo Repo
  • Mirror Mirror Certified Development Repo Repo Mirrored
  • Mirror Mirror Certified Development Repo Repo Mirrored
  • Mirror Mirror Certified Development Repo Repo Mirrored
  • Mirror Mirror Certified Development Repo Repo Mirrored
  • Mirror Mirror Certified Development Repo Repo Mirrored
  • ☚ Private Public ☛ GitHub Custom + Public Contrib
  • ☚ Private Public ☛ GitHub Custom + Public Contrib
  • ☚ Private Public ☛ Customized GitHub Custom + Public Contrib
  • ☚ Private Public ☛ Customized GitHub Custom + Public Contrib
  • ☚ Private Public ☛ Customized GitHub Custom + Public Contrib
  • GUIs
  • GitX
  • GitSafe
  • GitK
  • GitGUI
  • EGit
  • ci a l ! O f fi It ’s
  • 4 reasons
  • Cherry Pick ❹
  • Cherry Pick ❹
  • Cherry Pick ‣git ❹ cherry-pick a5b2ee
  • Cherry Pick ‣git ❹ cherry-pick a5b2ee ‣Merge in just one commit.
  • Cherry Pick ‣git ❹ cherry-pick a5b2ee ‣Merge in just one commit. ‣When you want a nugget, not a branchload.
  • Bisect Bugs ❸
  • Bisect Bugs ❸
  • Bisect Bugs ‣git ❸ bisect run mvn test
  • Bisect Bugs ‣git ❸ bisect run mvn test ‣Binary-search for bug.
  • Bisect Bugs ‣git ❸ bisect run mvn test ‣Binary-search for bug. ‣Manual or automated modes.
  • Squash Verbosity ❷
  • Squash Verbosity ❷
  • Squash Verbosity ❷ ‣git merge --squash mybranch
  • Squash Verbosity ❷ ‣git merge --squash mybranch ‣Reduce all your micro-checkins to block commits.
  • Squash Verbosity ❷ ‣git merge --squash mybranch ‣Reduce all your micro-checkins to block commits. ‣Make mistakes, revise, checkin without hesitation.
  • Squash Verbosity ❷ ‣git merge --squash mybranch ‣Reduce all your micro-checkins to block commits. ‣Make mistakes, revise, checkin without hesitation. ‣Great for SVN compatibility.
  • Search History ❶
  • Search History ❶
  • Search History ‣git ❶ grep SomeText HEAD^^^
  • Search History ‣git ❶ grep SomeText HEAD^^^ ‣Search in file history without checkout.
  • Search History ‣git ❶ grep SomeText HEAD^^^ ‣Search in file history without checkout. ‣Greps contents.
  • emerging Control Version
  • Twitter @matthewmccull Matthew Blog http://www.ambientideas.com/blog sidebar has all my social media links Email matthewm@ambientideas.com GitHub http://github.com/matthewmccullough
  • Resources Git Homepage http://git-scm.com Directed Acrylic Graph http://en.wikipedia.org/wiki/Directed_acyclic_graph Git for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/ Git Treeish http://book.git-scm.com/4_git_treeishes.html
  • Resources Git Docs http://www.kernel.org/pub/software/scm/git/docs/ Git Magic eBook http://www-cs-students.stanford.edu/~blynn/gitmagic/book.pdf Linus Torvald’s Git talk at Google http://www.youtube.com/watch?v=4XpnKHJAok8 CygWin http://www.cygwin.com
  • Resources MSysGit http://code.google.com/p/msysgit Git Cheetah http://code.google.com/p/msysgit/wiki/GitCheetah Matthew’s Git Bookmarks http://delicious.com/matthew.mccullough/git Matthew’s Bash Prompt http://gist.github.com/47267
  • Image Credits ‣ http://www.ambientideasphotography.com ‣ http://flickr.com/photos/lenore-m/2903856664/ ‣ http://en.wikipedia.org/wiki/Git_(software) ‣ http://flickr.com/photos/karenhorton/1583513014/ ‣ http://flickr.com/photos/mashdnart/2545782407/ ‣ http://commons.wikimedia.org/wiki/ File:Small_Boy_nuclear_test_1962.jpg ‣ http://www.flickr.com/photos/knmurphy/2506896257/ ‣ http://www.flickr.com/photos/albyspace/1022035568/ ‣ http://flickr.com/photos/michaelhays/3070238360/ ‣ http://flickr.com/photos/d_vdm/509996632/