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 full-size slide

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

    View full-size slide

  3. «narrative»

    View full-size slide

  4. meaningful
    commit messages

    View full-size slide

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

    View full-size slide

  6. “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 full-size slide

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

    View full-size slide

  8. 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 full-size slide

  9. stopwritingramblingcommitmessages.com

    View full-size slide

  10. descriptive
    branch names

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  13. linear
    repository history

    View full-size slide

  14. rebase
    everything

    View full-size slide

  15. git pull --rebase

    View full-size slide

  16. explicit
    merges (--no-ff)

    View full-size slide

  17. squash...
    ...sometimes

    View full-size slide

  18. tags
    for milestones

    View full-size slide

  19. project management
    software integration

    View full-size slide

  20. build artifacts

    View full-size slide

  21. signed commits

    View full-size slide

  22. .gitattributes

    View full-size slide

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

    View full-size slide

  24. git worktree

    View full-size slide

  25. shallow clones

    View full-size slide

  26. why is this important

    View full-size slide

  27. improved employee
    onboarding

    View full-size slide

  28. documentation right
    next to the code

    View full-size slide

  29. care about
    your tools

    View full-size slide

  30. work out your own
    best practices...

    View full-size slide

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

    View full-size slide

  32. git show questions?

    View full-size slide

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

    View full-size slide

  34. 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 full-size slide

  35. 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 full-size slide