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:
- Our usual branching approach is GitHub Flow.
-
Some projects with more complex release requirements have gone to
GitFlow via
HubFlow.
- Branch names should follow the style
[TYPE]/description-of-feature/[STORYID], where:
-
TYPE: one of feature, chore, bug, or other as appropriate.
-
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:
- Commit messages should follow the structure of a 1-liner + detailed breakdown.
- The 1-liner should describe why you are making the changes.
- 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.
- Tests should never fail on any given commit.
- There are a lot of ways to ensure this: choose what works for you.
- 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.
- To merge a branch make a Pull Request.
- 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.
- It’s also recommended you make use of Tasks.
- 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.
- Everything goes through Code Review before merge.
- Delete branches after they’re merged.
- If its ever a more complex discussion: just go do that, find a white board, and figure it out
in person.