Skip to content

Instantly share code, notes, and snippets.

@decklord
Created August 8, 2016 20:00
Show Gist options
  • Save decklord/1c2485eb9817fde6159762f861d682f3 to your computer and use it in GitHub Desktop.
Save decklord/1c2485eb9817fde6159762f861d682f3 to your computer and use it in GitHub Desktop.

PostCenter

Git Culture: Code Reviews & Commits

Documentation is really important when done right. We must make it a smart process instead of doing it painfully. One good way to document the development process is with git: commits and code reviews. Here are some really good tips for improving our team's work and build a strong development methodology and philosophy.

Better Commits

From 5 Useful Tips For A Better Commit Message and Better Commit Messages with a .gitmessage Template

Avoid using git commit -m

It gives you a poor mindset right off the bat as you will feel that you have to fit your commit message into the terminal command, and makes the commit feel more like a one-off argument than a page in history

Do not use:

git commit -m'my short bad description'

Instead use

git commit

And then

# Title
Redirect user to the requested page after login
# Link to issue
https://trello.com/path/to/relevant/card
# Why
Users were being redirected to the home page after login, which is less
useful than redirecting to the page they had originally requested before
being redirected to the login form.
# What
* Store requested path in a session variable
* Redirect to the stored location after successfully logging in the user

## Commit first line description on 50 lines or less.

Go longer on the following lines of the commit using git commit but keep your first line clear.

# Strong Code Review Culture:

This are some great ideas from this YouTube talk: RailsConf 2015 - Implementing a Strong Code-Review Culture

What's the focus on code reviews.

  • Not just bugs.
  • Learning.
  • Knowledge transfer.
  • Team awarness.

Commits: If content is king, context is god.

And follow the template. Then on your text editor, describe what you learned hunting this issue and why you did what you did. Link to the issue on your team issue tracker.

Reviewing

### Ask questions, not demands.

"Extract a service to reduce duplication"
->
"What do you thing about creating a service to remove duplication?"

##¿What to review?

  • Single Responsability Principle
  • DRY
  • Naming
  • Complexity
  • Test Coverage
  • Typos/Bugs
  • Same style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment