• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Git Basics - RubyFest 2009
 

Git Basics - RubyFest 2009

on

  • 7,144 views

A gentle introduction to the awesomeness of Git as presented a RubyFest, may 2009.

A gentle introduction to the awesomeness of Git as presented a RubyFest, may 2009.

Statistics

Views

Total Views
7,144
Views on SlideShare
6,914
Embed Views
230

Actions

Likes
31
Downloads
0
Comments
1

14 Embeds 230

http://weijing329.blogspot.tw 68
http://weijing329.blogspot.com 51
http://weijing329.wordpress.com 30
http://me.leonzhang.com 28
http://coderwall.com 19
http://www.slideshare.net 17
http://weijing329.blogspot.ca 5
http://www.linkedin.com 3
http://weijing329.blogspot.hk 3
http://23.23.178.183 2
http://weijing329.blogspot.sg 1
https://twitter.com 1
http://engineerball.com 1
http://www.slashdocs.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • great introduction to git
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Git Basics - RubyFest 2009 Git Basics - RubyFest 2009 Presentation Transcript

  • GIT BASICS by Ariejan de Vroom – Kabisa ICT
  • WHAT THE GIT?! “I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.” – Linus Torvalds
  • GET GIT! http://git-scm.com/
  • SURVEY • Who is NOT using version control? • SubVersion? • Anything else?
  • WHY GIT?! • Distributed Repositories • Non-linear Development • Very fast branching and merging • Toolkit Design • Scales • Cryptographic authentication of history.
  • LET’S ROCK! ~/gitbasics $ git init Initialized empty Git repository in /Users/ariejan/gitbasics/.git/
  • LET’S ROLL! ~/gitbasics $ git clone git@github.com/ariejan/gitbasics.git
  • ~/gitbasics $ echo quot;Live long and prosperquot; > README ~/gitbasics $ git add README ~/gitbasics $ git commit -m quot;Added READMEquot; [master (root-commit)]: created 8e60b09: quot;Added READMEquot; 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 README
  • WHAT JUST HAPPENED? ~/gitbasics $ git log commit 8e60b09d3082e9473944075cc01b3b67bb97d5c3 Author: Ariejan de Vroom <ariejan@ariejan.net> Date: Mon May 11 21:51:24 2009 +0200 Added README
  • HOW GIT WORKS Working Directory git add Staging Area git commit Repository
  • WORKFLOW • Hack! ( TextMate, vim, ... ) • Stage your changes ( git add ) • Review your changes ( git status | diff ) • Commit (locally) ( git commit ) • Repeat
  • USING BRANCHES • Very, very fast • Keep different code paths separate • Try new things • Atomic merges!
  • SURVEY • How many of you use branching? • Do you work exclusively on trunk/master? • NEVER work on trunk/master?
  • BRANCHING c1 c2 c3 c4 c5 c6
  • LET’S BRANCH! ~/gitbasics $ git checkout -b new_feature Switched to a new branch quot;new_featurequot; ~/gitbasics $ git branch master * new_feature ~/gitbasics $ git checkout master Switched to branch quot;masterquot; ~/gitbasics $ git branch -d feature3 Deleted branch feature3
  • MERGING • Merge two branches together • Add new features • Add bugs fixes
  • MERGING c1 c2 c3 c4 c7 c5 c6
  • MERGING ~/gitbasics $ git checkout master Switched to branch quot;masterquot; ~/gitbasics $ git merge new_feature
  • REBASING • Bring a branch up-to-date • Rebasing is rewriting history! • Don’t use rebasing on a branch you’re sharing!
  • REBASING c1 c2 c3 c4 c3’ c4’ c5 c6
  • REBASING ~/gitbasics $ git checkout new_feature Switched to branch quot;new_featurequot; ~/gitbasics $ git rebase master
  • REMOTE • Store and share your code! • github.com • gitosis ( self-managed over SSH )
  • PUSH ~/gitbasics $ git add origin git@github.com/ariejan/ gitbasics.git ~/gitbasics $ git push origin master
  • FETCH / PULL ~/gitbasics $ git fetch origin ~/gitbasics $ git pull origin master
  • WORKFLOW Working Directory add Staging Area checkout merge commit Repository pull push fetch Remote
  • TAGGING • Mark a point in history • Optionally sign it cryptographically with GnuPG
  • TAGGING v1.0 c1 c2 c3 c4
  • TAGGING ~/gitbasics $ git tag -a -m quot;Tag v1.0quot; v1.0 Switched to branch quot;new_featurequot; ~/gitbasics $ git tag v1.0 ~/gitbasics $ git push --tags
  • BISECTING • Binary search for a bad commit • Find out where it when wrong (and who to blame)
  • BISECTING v1.0 Good or Bad? c1 c2 c3 c4 c5 c6 c7
  • BISECTING ~/gitbasics $ git bisect start ~/gitbasics $ git bisect bad ~/gitbasics $ git bisect good v1.0 ~/gitbasics $ git bisect bad | good ~/gitbasics $ git bisect reset ~/gitbasics $ git bisect start HEAD v1.0
  • RELEASE MANAGEMENT • Manage your DTSP environments • Branches to the rescue!
  • RELEASE MANAGEMENT ~/gitbasics $ git branch production master ~/gitbasics $ git push origin production ~/gitbasics $ git checkout --track -b production origin/production
  • RELEASE MANAGEMENT ~/gitbasics $ git checkout production ~/gitbasics $ git rebase master ~/gitbasics $ git push origin production
  • TAGGING RELEASES ~/gitbasics $ git checkout master ~/gitbasics $ git tag -a -m quot;Tag v1.0.3quot; v1.0.3 ~/gitbasics $ git push --tags ~/gitbasics $ git checkout production ~/gitbasics $ git rebase v1.0.3 ~/gitbasics $ git push origin production
  • THE STASH • Stash away uncommited changes • Ideal for quick bug fixes!
  • THE STASH ~/gitbasics $ git status # modified: README ~/gitbasics $ git stash ~/gitbasics $ git status nothing to commit # Hack, stage, review, commit, etc. ~/gitbasics $ git stash pop ~/gitbasics $ git status # modified: README
  • CONFLICTS • Conflicts happen • Git is clever • Easy to resolve manually • Merges are atomic!
  • CONFLICTS ~/gitbasics $ git merge awesome_feature Auto-merged README CONFLICT (content): Merge conflict in README Automatic merge failed; fix conflicts and then commit the result. ~/gitbasics $ vim README ~/gitbasics $ git add README ~/gitbasics $ git commit -m “fixed merge conflict”
  • .GITIGNORE • Specify which files to keep out of git • Location specific configuration • Generated files • Binary build files
  • .GITIGNORE ~/gitbasics $ cat .gitignore config/database.yml log/*.log tmp/* public/system/uploads/*
  • SURVEY • Who is going to try Git? • Stick with SubVersion?
  • WE’RE HIRING! AWESOME CODERS recruitment@kabisa.nl
  • THANKS! Slides will be posted to http://slideshare.net/ariejan Contact me at ariejan@kabisa.nl