• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Git Basics Philips
 

Git Basics Philips

on

  • 3,206 views

My Git Basics talk, adapted for presentation at Phillps.

My Git Basics talk, adapted for presentation at Phillps.

Statistics

Views

Total Views
3,206
Views on SlideShare
3,185
Embed Views
21

Actions

Likes
7
Downloads
0
Comments
0

4 Embeds 21

http://coderwall.com 18
http://www.slideshare.net 1
http://www.linkedin.com 1
https://www.linkedin.com 1

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
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Git Basics Philips Git Basics Philips Presentation Transcript

    • GIT BASICS by Ariejan de Vroom – Kabisa ICT 30th Juny 2009
    • 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 "Live long and prosper" > README ~/gitbasics $ git add README ~/gitbasics $ git commit -m "Added README" [master (root-commit)]: created 8e60b09: "Added README" 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 "new_feature" ~/gitbasics $ git branch master * new_feature ~/gitbasics $ git checkout master Switched to branch "master" ~/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 "master" ~/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 "new_feature" ~/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 commit checkout merge Repository push fetch pull 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 "Tag v1.0" v1.0 Switched to branch "new_feature" ~/gitbasics $ git tag v1.0 ~/gitbasics $ git push --tags
    • 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”
    • GIT-SVN It’s like being the Chuck Norris of the team!
    • ASSUME THIS ~/gitbasics $ svn log http://svnhub.com/project/trunk ------------------------------------------------------ r17048 | ariejan | 2009-06-30 .... Updated README. SVN Repository courtesy of SVNHub.com
    • CHECKOUT ~ $ mkdir gitbasics ~ $ cd gitbasics ~/gitbasics $ git-svn init http://svnhub.com/project/ trunk ~/gitbasics $ git-svn fetch -r17048 A README
    • UPDATE ~/gitbasics $ git-svn rebase
    • COMMIT ~/gitbasics $ git-svn dcommit
    • WORKFLOW ~/gitbasics $ git-svn init URL ~/gitbasics $ git-svn rebase && git-svn fetch ~/gitbasics $ git checkout -b new_feature ~/gitbasics $ git add && git commit ~/gitbasics $ git checkout master ~/gitbasics $ git-svn rebase ~/gitbasics $ git merge new_feature ~/gitbasics $ git-svn dcommit
    • SURVEY • Who is going to try Git? • Stick with SubVersion? • Try git-svn?
    • THANKS! Slides will be published at http://slideshare.net/ariejan Contact me at ariejan@kabisa.nl