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

a crash course on git
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

A Crash Course on Git

Sean Payne Temecula Valley Software Developers Meetup

slide-2
SLIDE 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

slide-3
SLIDE 3

Why choose Git?

  • Open source
  • Lightweight & fast
  • Entire history is local
  • Powerful & easy branching & merging
  • Stashing
  • Rapidly growing / enthusiastic community
  • Decentralized
  • Free
slide-4
SLIDE 4
  • Windows

msysGit: http://msysgit.github.com/ Git-Extensions: https://code.google.com/p/gitextensions/

  • OS X
  • git-osx-installer:http://sourceforge.net/projects/git-osx-installer/
  • via MacPorts

Git-ing Started

slide-5
SLIDE 5
  • Linux

Debian/Ubuntu: sudo apt-get install git RedHat/Fedora: yum install git-core

  • Compile from source

Git-ing Started

slide-6
SLIDE 6

Lifecycle

  • 1. clone / init
  • 2. add / modify
  • 3. commit
  • 4. push
  • 5. Repeat 2-4
slide-7
SLIDE 7

Lifecycle

New Unmodified Modified Staged Remoted Add Clone

slide-8
SLIDE 8

Lifecycle

New Unmodified Modified Staged Remoted Add Clone Edit

slide-9
SLIDE 9

Lifecycle

New Unmodified Modified Staged Remoted Add Clone Edit Stage

slide-10
SLIDE 10

Lifecycle

New Unmodified Modified Staged Remoted Add Clone Edit Stage Commit

slide-11
SLIDE 11

Lifecycle

New Unmodified Modified Staged Remoted Add Clone Edit Stage Commit Push

slide-12
SLIDE 12

git init .

slide-13
SLIDE 13

git config user.name

slide-14
SLIDE 14

git add .

slide-15
SLIDE 15

git commit -m “Initial commit”

slide-16
SLIDE 16
slide-17
SLIDE 17

Branching

  • Allows concurrent

modifications from a given point

  • ‘master’ is the

default mainline branch

  • Branches are

merged

slide-18
SLIDE 18

git branch test && git checkout test

slide-19
SLIDE 19

Modifying in branch

slide-20
SLIDE 20

Switching branches

slide-21
SLIDE 21

Merging

slide-22
SLIDE 22

Moving in on your turf

slide-23
SLIDE 23

Would you like to play a game?

slide-24
SLIDE 24

Fighting with yourself

slide-25
SLIDE 25

So similar, but different

slide-26
SLIDE 26

Two become one

slide-27
SLIDE 27

Resolving conflicts

slide-28
SLIDE 28

Resolving conflicts

slide-29
SLIDE 29

Give & Take (Pushing & Pulling)

  • Can be local folder
  • Or remote host (e.g. GitHub, BitBucket)
  • git://url.to/git/repo.git (port 9418)
  • ssh:username@host/path/to/git.repo
  • http(s)://url.to/git/repo
  • Pros & Cons for each
  • See the following for more info:

http://git-scm.com/book/en/Git-on-the-Server-The-Protocols

slide-30
SLIDE 30

Sweep it under the rug (Stashing)

  • Commits current changes to a special

branch and restores last committed state.

  • Stashes are stored as a stack
  • Newly stashed items are placed at the top of the

stash stack: git stash save

  • Stashes are popped off the stack: git stash pop
  • Stash stack items can also be “out-of-stack” if

necessary: git stash pop <stash id>

slide-31
SLIDE 31

But wait, there’s more!

  • Tags
  • Rebasing
  • Cherry Picking
  • SVN interop*
  • Bisect
  • Submodules
slide-32
SLIDE 32

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