Git Basics Philips

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Git Basics Philips - Presentation Transcript

    1. GIT BASICS by Ariejan de Vroom – Kabisa ICT 30th Juny 2009
    2. WHAT THE GIT?! “I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.” – Linus Torvalds
    3. GET GIT! http://git-scm.com/
    4. SURVEY • Who is NOT using version control? • SubVersion? • Anything else?
    5. WHY GIT?! • Distributed Repositories • Non-linear Development • Very fast branching and merging • Toolkit Design • Scales • Cryptographic authentication of history.
    6. LET’S ROCK! ~/gitbasics $ git init Initialized empty Git repository in /Users/ariejan/gitbasics/.git/
    7. LET’S ROLL! ~/gitbasics $ git clone git@github.com/ariejan/gitbasics.git
    8. ~/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
    9. 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
    10. HOW GIT WORKS Working Directory git add Staging Area git commit Repository
    11. WORKFLOW • Hack! ( TextMate, vim, ... ) • Stage your changes ( git add ) • Review your changes ( git status | diff ) • Commit (locally) ( git commit ) • Repeat
    12. USING BRANCHES • Very, very fast • Keep different code paths separate • Try new things • Atomic merges!
    13. SURVEY • How many of you use branching? • Do you work exclusively on trunk/master? • NEVER work on trunk/master?
    14. BRANCHING c1 c2 c3 c4 c5 c6
    15. 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
    16. MERGING • Merge two branches together • Add new features • Add bugs fixes
    17. MERGING c1 c2 c3 c4 c7 c5 c6
    18. MERGING ~/gitbasics $ git checkout master Switched to branch "master" ~/gitbasics $ git merge new_feature
    19. REBASING • Bring a branch up-to-date • Rebasing is rewriting history! • Don’t use rebasing on a branch you’re sharing!
    20. REBASING c1 c2 c3 c4 c3’ c4’ c5 c6
    21. REBASING ~/gitbasics $ git checkout new_feature Switched to branch "new_feature" ~/gitbasics $ git rebase master
    22. REMOTE • Store and share your code! • github.com • gitosis ( self-managed over SSH )
    23. PUSH ~/gitbasics $ git add origin git@github.com/ariejan/ gitbasics.git ~/gitbasics $ git push origin master
    24. FETCH / PULL ~/gitbasics $ git fetch origin ~/gitbasics $ git pull origin master
    25. WORKFLOW Working Directory add Staging Area commit checkout merge Repository push fetch pull Remote
    26. TAGGING • Mark a point in history • Optionally sign it cryptographically with GnuPG
    27. TAGGING v1.0 c1 c2 c3 c4
    28. 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
    29. THE STASH • Stash away uncommited changes • Ideal for quick bug fixes!
    30. 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
    31. CONFLICTS • Conflicts happen • Git is clever • Easy to resolve manually • Merges are atomic!
    32. 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”
    33. GIT-SVN It’s like being the Chuck Norris of the team!
    34. ASSUME THIS ~/gitbasics $ svn log http://svnhub.com/project/trunk ------------------------------------------------------ r17048 | ariejan | 2009-06-30 .... Updated README. SVN Repository courtesy of SVNHub.com
    35. CHECKOUT ~ $ mkdir gitbasics ~ $ cd gitbasics ~/gitbasics $ git-svn init http://svnhub.com/project/ trunk ~/gitbasics $ git-svn fetch -r17048 A README
    36. UPDATE ~/gitbasics $ git-svn rebase
    37. COMMIT ~/gitbasics $ git-svn dcommit
    38. 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
    39. SURVEY • Who is going to try Git? • Stick with SubVersion? • Try git-svn?
    40. THANKS! Slides will be published at http://slideshare.net/ariejan Contact me at ariejan@kabisa.nl
    SlideShare Zeitgeist 2009

    + Ariejan de VroomAriejan de Vroom Nominate

    custom

    473 views, 0 favs, 0 embeds more stats

    My Git Basics talk, adapted for presentation at Phi more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 473
      • 473 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories