Triangle.rb Notes - Deliberate Git

Deliberate Git

2013-08-13 by Stephen Ball (Meetup) (blog post)

Git Commits

  • last forever
  • extremely searchable
  • available to everyone

Commit messages have a short, imperitive subject, followed by a longer description about why. Write final commit messages as if a coworker has sent an email asking for a summary

Commit Subjects

  • written in the present tense
  • written as a command (because its a todo item)

Commit Body

  • can be informal
  • describe the "why?"
  • message to the team

Commits tell us:

  • what the change does
  • why it's neccessary
  • commits are tied to the code change
  • they are comments that expire automatically

Flow

  • WIP commits while coding
  • commit frequently
  • rewrite your commits

git rebase -i

  • rewrite commits
  • remove commits
  • combine commits
  • reorder commits

Searching History

  • git log --grep="commit contents"
  • git log -S"diff contents"

Other Resources