Git


We love Git, and we love GitHub.

Branching

We like each branch to be for a standalone thing, we like our branches to be short-lived when possible, and we like our branches to be easy to map back to our process.

In practice, this means:

  1. Our usual branching approach is GitHub Flow.
  2. Some projects with more complex release requirements have gone to GitFlow via HubFlow.
  3. Branch names should follow the style [TYPE]/description-of-feature/[STORYID], where:
    1. TYPE: one of feature, chore, bug, or other as appropriate.
    2. STORYID: unique story identifier for your particular tracker.

Commit Style

Commits should be atomic, yet complete changes that tell the story of your feature. There should also never be a commit that breaks the code-base.

In practice, this means:

  1. Commit messages should follow the structure of a 1-liner + detailed breakdown.
    1. The 1-liner should describe why you are making the changes.
    2. The detailed description should provide a high-level overview of what the changes are, and can touch deeper on your design decisions, rationale for the approach, and the breadth of the changes.
  2. Tests should never fail on any given commit.
    1. There are a lot of ways to ensure this: choose what works for you.
    2. Options include: being pristine as you work, interactive rebases (though be careful once you’ve made your pull-request), or tools like stg.

Pull Requests

Make Pull Requests for each thing, wait for code review, and be a good human; and things will work out well.

  1. To merge a branch make a Pull Request.
  2. GitHub has a fantastic Pull Request blog post, covering how to write a great Pull Request, and particularly, how to review one. Read this, and follow it.
  3. It’s also recommended you make use of Tasks.
    1. This helps show what you’re working on, track comments, and what’s still outstanding. It’s a direct way to show that a Pull Request is still a WIP as well.
  4. Everything goes through Code Review before merge.
  5. Delete branches after they’re merged.
  6. If its ever a more complex discussion: just go do that, find a white board, and figure it out in person.