Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tell a story with your (git) repository

Tell a story with your (git) repository

Repository history is often overlooked as a tool to keep information about project development process. You can change that by following several rules.

Tomasz Kowalczyk

September 15, 2016
Tweet

More Decks by Tomasz Kowalczyk

Other Decks in Programming

Transcript

  1. tell a story
    with your
    repository

    View Slide

  2. $ git config -l
    user.name = Tomasz Kowalczyk
    user.twitter = tmmx
    user.github = thunderer

    View Slide

  3. Story?

    View Slide

  4. View Slide

  5. View Slide

  6. View Slide

  7. View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. «narrative»

    View Slide

  12. meaningful
    commit messages

    View Slide

  13. “bugfix”
    “fixed bug #1337”
    “minor changes”
    “review fixes”
    “working on it”
    “update”
    “fixtures”
    “fixed tests”
    “enhancements”
    “YOLO”

    View Slide

  14. View Slide

  15. “installation script fails without mbstring, added
    sanity check before executing command”
    “[ISSUE-12] redirect to user profile after
    finished setup”
    “added JSON serialization handler for article
    entity, fixes #1337”

    View Slide

  16. short description
    (empty line)
    longer story
    about the changeset
    which explains
    its purpose

    View Slide

  17. added extensions sanity check before installation
    installation script requires mbstring extension to
    correctly process fixtures inserted in the database.
    we should detect its presence so the data is not
    malformed and installation is not corrupted.

    View Slide

  18. stopwritingramblingcommitmessages.com

    View Slide

  19. View Slide

  20. descriptive
    branch names

    View Slide

  21. “new-tests”
    “issue-1337”
    “bugfix”
    “temporary-dev”
    “refactoring-2”

    View Slide

  22. View Slide

  23. “issue1337-new-payment-form”
    “replace-serialization-library”
    “bug-invalid-profile-redirect”
    “php7-migration”

    View Slide

  24. linear
    repository history

    View Slide

  25. View Slide

  26. git bisect

    View Slide

  27. rebase
    everything

    View Slide

  28. git pull

    View Slide

  29. git pull --rebase

    View Slide

  30. explicit
    merges (--no-ff)

    View Slide

  31. View Slide

  32. squash...
    ...sometimes

    View Slide

  33. tags
    for milestones

    View Slide

  34. technology

    View Slide

  35. project management
    software integration

    View Slide

  36. large files

    View Slide

  37. build artifacts

    View Slide

  38. signed commits

    View Slide

  39. .gitattributes

    View Slide

  40. .gitignore

    View Slide

  41. git obliterate
    git filter-branch
    BFG Repo-Cleaner

    View Slide

  42. git worktree

    View Slide

  43. shallow clones

    View Slide

  44. why is this important

    View Slide

  45. improved employee
    onboarding

    View Slide

  46. documentation right
    next to the code

    View Slide

  47. care about
    your tools

    View Slide

  48. work out your own
    best practices...

    View Slide

  49. ...but whatever you do,
    be consistent

    View Slide

  50. git show questions?

    View Slide

  51. git commit -m “thanks!”
    Twitter @tmmx GitHub /thunderer

    View Slide

  52. Images:
    https://www.flickr.com/photos/mattbuck007/3794250164 (trains bg)
    https://twitter.com/HenryHoffman/status/694184106440200192 (guitar hero)
    https://xkcd.com/1296 (git history)
    https://xkcd.com/1597 (what is git)
    https://www.flickr.com/photos/blackroompictures/22583733139 (straight railroad)
    https://www.flickr.com/photos/genista/2072491605 (rubble)
    https://www.flickr.com/photos/archer10/5299318419 (acropolis)
    https://www.flickr.com/photos/jonwestra78/14843670025 (library)
    https://git-scm.com/downloads/logos (git)
    https://twitter.com/davrous/status/767013225426620417 (git merge)
    https://twitter.com/GIFs/status/767968973732196352 (merge conflict)
    Links:
    http://stopwritingramblingcommitmessages.com
    http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
    https://www.reddit.com/r/ProgrammerHumor/comments/43ug8t/i_fucked_up_git_so_bad_it_turned_into_guitar_hero

    View Slide

  53. Resources:
    http://learngitbranching.js.org
    https://www.reviewboard.org/docs/codebase/dev/git/clean-commits
    https://news.ycombinator.com/item?id=4130494 (git aliases)
    https://github.com/erlang/otp/wiki/Writing-good-commit-messages
    https://zachholman.com/posts/git-commit-history
    https://stackoverflow.com/questions/1057564/pretty-git-branch-graphs
    http://chris.beams.io/posts/git-commit
    https://sethrobertson.github.io/GitBestPractices
    https://github.com/torvalds/subsurface/blob/master/README#L82-109
    https://github.com/git/git/commit/b3f1280ec740d8012d18e870a50a5ff76c4e3c42
    https://who-t.blogspot.co.at/2009/12/on-commit-messages.html
    http://developercertificate.org
    https://git-scm.com/book/en/v2
    https://rtyley.github.io/bfg-repo-cleaner
    https://softwareswirl.blogspot.co.uk/2013/05/git-imerge-practical-introduction.html
    http://nvie.com/posts/a-successful-git-branching-model
    http://nuclearsquid.com/writings/git-tricks-tips-workflows
    https://help.github.com/articles/remove-sensitive-data

    View Slide