$30 off During Our Annual Pro Sale. View Details »

Git your act together

Roy Tomeij
November 15, 2011

Git your act together

If you don't use version control, git is a good start. If you use SVN, git has clear advantages. If you use git, I'll dive into some lesser know uses.

The content of this talk is largely dependent on the audience at hand. In the wild I'll either skip some slides or go over them in greater detail. This deck is accompanied by Terminal action :-)

Roy Tomeij

November 15, 2011
Tweet

More Decks by Roy Tomeij

Other Decks in Programming

Transcript

  1. GIT YOUR ACT TOGETHER.

  2. SO, WHAT DO I KNOW? ‣ Hi, I’m Roy Tomeij

    ‣ Co-founder 80beans ‣ Front-end since 1998 ‣ Version control since 2004 ‣ Git since 2008
  3. DISCLAIMER: GIT TALKS ARE HARD.

  4. YOU NEED VERSIONING.

  5. Why version control? ‣ Have a backup. ‣ Revert code.

    ‣ Have multiple branches. ‣ Know your history. ‣ Work with a team.
  6. GIT IS DIFFERENT.

  7. How is Git different from SVN? ‣ Distributed instead of

    centralized. ‣ Snapshots instead of differences. ‣ Hash instead of revision number. ‣ Ignoring files is intuitive. ‣ No friggin’ .svn directories.
  8. Distribution.

  9. Differences vs snapshots. SVN below.

  10. Snapshots vs differences. Git below.

  11. GIT ONLY ADDS DATA.

  12. SO, HOW DOES IT WORK?

  13. Anatomy & file status.

  14. Pull, push & merge.

  15. Branches. ‣ Great way to work on multiple features, versions,

    etc. ‣ Git knows which commits belong to which branch. ‣ Default branch is “master”.
  16. A branching example.

  17. A branching example. $ git checkout -b iss53 Switched to

    a new branch "iss53"
  18. A branching example. $ nano index.html $ git commit -am

    'Add a new footer'
  19. A branching example. $ Make some changes in “master” and

    “iss53”.
  20. A branching example. $ git checkout master $ git merge

    iss53
  21. KEEP IT CLEAN.

  22. Keep your log clean. ‣ Write proper commit messages. ‣

    Commit everything separately. ‣ Use “git pull --rebase”. ‣ Use “git commit --amend” to fix your list commit (message).
  23. TIME TO GET ORGANIZED.

  24. Git Flow: a branching model. ‣ http://github.com/nvie/gitflow ‣ Manages features,

    hotfixes, etc.
  25. QUALITY IS KING.

  26. GitHub. ‣ Free public repositories. ‣ Contribute to open source

    projects. ‣ Fork and build upon existing code.
  27. GitHub Pull Requests. ‣ Create a branch for each feature.

    ‣ When done, create a pull request. ‣ Have others peer review. ‣ Merge into your master branch.
  28. Time left? ‣ git blame ‣ git add -p ‣

    git rebase -i ‣ git cherry-pick ‣ git bisect
  29. QUESTIONS?

  30. Acknowledgements. ‣ Some images taken from http://progit.org/.