Skip to content

Instantly share code, notes, and snippets.

@GiorgioNatili
Created December 22, 2016 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GiorgioNatili/826351c1ed2cee8c7cd0e146afe5dd77 to your computer and use it in GitHub Desktop.
Save GiorgioNatili/826351c1ed2cee8c7cd0e146afe5dd77 to your computer and use it in GitHub Desktop.
## Pull Request Merging Strategies and Commit Messages
The GIT history is a precious source of information and documentation, the aim of the outlined practices is to keep it more readable and rich of information.
### Branch Naming Convention and Practices
Every branch name should start with the JIRA ticket if the feature is not associated with
a JIRA ticket it can be omitted.
It's strongly recommended to push changes on a daily base; this will help the rest of the team understanding what's going on with the development.
Even more, just in case you get sick or win the lottery and resign, your team members will be able to complete the feature you were working on.
### Formate Commit Message
The log message is arguably the most important part of a commit, because it’s the only place
that captures not only what was changed, but why.
A short (70 chars or less) summary containing optionally the JIRA ticket using present tense.
Example:
`Fix hostname validation in digital property - URX-110`
If necessary, more detailed explanatory text with bullet points. It's very important that possible
side effects of the changes are documented clearly and coincisely.
Example:
``
* Update the regex definition
* Change the priority of the event handler
* Update tests to support the updated behavior
``
### Squashing
It happens that, during development and code review, engineers push on GIT commits containing logs that are not relevant to the feature they are developing.
An example can be `Fix variable misspelling` or `Fix code review formatting issues`, etc.
In this case, squashing together some commits improve the readability of the GIT history significantly.
To squash commits together you can simply rebase your branch `$ git rebase -i HEAD~4`.
### Resources
* https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message
* http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
* http://alistapart.com/article/the-art-of-the-commit
* https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment