a crash course on git
play

A Crash Course on Git Sean Payne Temecula Valley Software - PowerPoint PPT Presentation

A Crash Course on Git Sean Payne Temecula Valley Software Developers Meetup What is Git? Distributed Version Control System (DVCS) Built from 2005 onwards by the Linux kernel dev team Like CVS, SVN & others, allows historical


  1. A Crash Course on Git Sean Payne Temecula Valley Software Developers Meetup

  2. What is Git? • Distributed Version Control System (DVCS) • Built from 2005 onwards by the Linux kernel dev team • Like CVS, SVN & others, allows historical tracking of changes • Unlike CVS, SVN & others, it is decentralized

  3. Why choose Git? • Open source • Lightweight & fast • Entire history is local • Powerful & easy branching & merging • Stashing • Rapidly growing / enthusiastic community • Decentralized • Free

  4. Git-ing Started • Windows msysGit: http://msysgit.github.com/ Git-Extensions: https://code.google.com/p/gitextensions/ • OS X o git-osx-installer:http://sourceforge.net/projects/git-osx-installer/ o via MacPorts

  5. Git-ing Started • Linux Debian/Ubuntu: sudo apt-get install git RedHat/Fedora: yum install git-core • Compile from source

  6. Lifecycle 1. clone / init 2. add / modify 3. commit 4. push 5. Repeat 2-4

  7. New Unmodified Modified Staged Remoted Clone Add Lifecycle

  8. New Unmodified Modified Staged Remoted Clone Add Edit Lifecycle

  9. New Unmodified Modified Staged Remoted Clone Add Edit Stage Lifecycle

  10. New Unmodified Modified Staged Remoted Clone Add Edit Stage Commit Lifecycle

  11. New Unmodified Modified Staged Remoted Clone Add Edit Stage Commit Push Lifecycle

  12. git init .

  13. git config user.name

  14. git add .

  15. git commit - m “Initial commit”

  16. Branching • Allows concurrent modifications from a given point • ‘master’ is the default mainline branch • Branches are merged

  17. git branch test && git checkout test

  18. Modifying in branch

  19. Switching branches

  20. Merging

  21. Moving in on your turf

  22. Would you like to play a game?

  23. Fighting with yourself

  24. So similar, but different

  25. Two become one

  26. Resolving conflicts

  27. Resolving conflicts

  28. Give & Take (Pushing & Pulling) • Can be local folder • Or remote host (e.g. GitHub, BitBucket) o git:// url.to/git/repo.git (port 9418) o ssh: username@host/path/to/git.repo o http(s):// url.to/git/repo • Pros & Cons for each o See the following for more info: http://git-scm.com/book/en/Git-on-the-Server-The-Protocols

  29. Sweep it under the rug (Stashing) • Commits current changes to a special branch and restores last committed state. • Stashes are stored as a stack o Newly stashed items are placed at the top of the stash stack: git stash save o Stashes are popped off the stack: git stash pop o Stash stack items can also be “out -of- stack” if necessary: git stash pop <stash id>

  30. But wait, there’s more! • Tags • Rebasing • Cherry Picking • SVN interop* • Bisect • Submodules

  31. Additional Information • https://git.wiki.kernel.org/index.php/Main_Page • http://git-scm.com/ • http://help.github.com • http://www.launchacademy.com/codecabulary/learn-git/ Thanks! Sean Payne www.seanpayne.name

Recommend


More recommend