The everyday developer's guide to version control with Git

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.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

  • + alecclews Alec Clews 3 weeks ago
    Erh -- you can’t perform a commit with an empty index (which is what I think you are implying above), unless you specify --allow-empty to the commit command. e.g.

    $ git commit -m 'initial commit' --allow-empty
    [master (root-commit)]: created 24d18cd: 'initial commit'
Post a comment
Embed Video
Edit your comment Cancel

5 Favorites

The everyday developer's guide to version control with Git - Presentation Transcript

  1. The everyday developer’s guide to version control with git
  2. so, what’s git?
  3. “ Git is distributed version control system focused on speed, effectivity and real- world usability on large projects. - git-scm.com
  4. basic source control system (example) http://hoth.entp.com/output/git_for_designers.html
  5. but why git?
  6. lots of people use it (it’s common) http://en.wikipedia.org/wiki/Git_(software)
  7. let’s git started
  8. create (initialize) a repository $ cd (project-directory) $ git init Initialized empty Git repository in .git/
  9. your first save (commit) $ git commit -m 'Initial commit'
  10. create some files $ touch README
  11. see what’s changed $ git status # On branch master # # Initial commit # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # README nothing added to commit but untracked files present (use "git add" to track)
  12. adding files Adding a individual file $ git add README Adding a multiple files $ git add .
  13. see what’s changed (again) $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: README #
  14. save (commit) your changes $ git commit -m 'Added README file' Created initial commit c1195b5: Added README file 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 README
  15. check your history $ git log commit c1195b51d6e99dcc6e88b6ae44eea20ba1f0868e Author: Erin Carter <me@erincarter.com> Date: Thu Oct 29 12:21:24 2009 -0500 Added README file
  16. developing with git
  17. undoing your changes $ git checkout README
  18. reverting to specific version $ git checkout 3607253d20c7a295965f798109f9d4af0fbeedd8 <file name>
  19. reverting back $ git reset HEAD <file name>
  20. developing parallel with branching http://hoth.entp.com/output/git_for_designers.html
  21. create a branch $ git checkout -b bugfix Switched to a new branch “bugfix”
  22. switching branches $ git status # On branch bugfix nothing to commit (working directory clean) $ git checkout master Switched to branch “master”
  23. collaborating with git
  24. public repos = free private repos = cheap http://github.com
  25. clone a hosted repository $ git clone git://github.com/git/hello- world.git Initialized empty Git repository in /Users/me/Projects/hello- world/.git/ remote: Counting objects: 158, done. remote: Compressing objects: 100% (79/79), done. remote: Total 158 (delta 54), reused 157 (delta 54) Receiving objects: 100% (158/158), 15.62 KiB, done. Resolving deltas: 100% (54/54), done. $ cd hello-world
  26. pull changes (and pull often) $ git pull origin master
  27. add changes to master $ git checkout master $ git merge bugfix
  28. push changes $ git push origin master
  29. configure & customize git
  30. configuring $ git config --global user.name "Erin Carter" $ git config --global user.email "me@erincarter.com"
  31. add pretty colors $ git config --global color.diff auto $ git config --global color.status auto $ git config --global color.branch auto
  32. git tools
  33. gitk usually comes with git - http://gitk.sourceforge.net/
  34. GitX http://gitx.frim.nl
  35. TortoiseGit http://code.google.com/p/tortoisegit/
  36. git resources
  37. Pro Git (book) free online at http://progit.org/book/
  38. Pragmatic Version Control Using Git (book) http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git
  39. Git Community Book http://book.git-scm.com/
  40. Git Cheat Sheet http://ktown.kde.org/~zrusin/git/git-cheat-sheet-large.png
  41. what to remember ‣ commit often ‣ pull often ‣ use checkout and reset with caution ‣ create your own repository anywhere http://hoth.entp.com/output/git_for_designers.html
  42. fin
  43. @erincarter me@erincarter.com linkedin.com/in/erincarter illustrations by Simon Oxley of idokungfood.com theme inspired by Scott Chacon’s git-scm.com

+ Erin CarterErin Carter, 3 weeks ago

custom

762 views, 5 favs, 1 embeds more stats

A introductory presentation on using Git for versio more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 762
    • 761 on SlideShare
    • 1 from embeds
  • Comments 1
  • Favorites 5
  • Downloads 33
Most viewed embeds
  • 1 views on http://www.slideshare.net

more

All embeds
  • 1 views on http://www.slideshare.net

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