Skip to content

Instantly share code, notes, and snippets.

@yugarinn
Created January 28, 2019 17:18
Show Gist options
  • Save yugarinn/27f25310f44a1b6d51c7b57b7d638e02 to your computer and use it in GitHub Desktop.
Save yugarinn/27f25310f44a1b6d51c7b57b7d638e02 to your computer and use it in GitHub Desktop.
git-bits

RGCIFUWWWTOEJBY or "Random Git Conventions I Found Useful While Working With Teams Or Even Just By Myself"

Each of this RGCIFUWWWTOEJBY's can be used by themselves or in combination with everything else.

How often should I commit?

As often as logically possible. I mean, commits are free of charge.

How to name my commits?

  1. Limit the message to 50 characters.
  2. Capitalize the first word.
  3. Use the imperative mode. As a rule a thumb, imagine you are trying to complete the phrase "When applied, this commit will ______".

Good commit messages

git commit -m "Add new validation logic to the UserRequest class"
git commit -m "Refactor Auth class signup method for readability"
git commit -m "Add parsing logic for the offer method inputs"

Bad commit messages

git commit -m "New validation logic"
git commit -m "making signup method easy to read"
git commit -m "more fixes for broken stuff"

How to name my branches?

For master and develop this is pretty straight forward, they should be called, well, master and develop.

In the feature, bugfix and hotfix cases you are going to want to be a bit more verbose though.

<feature|bugfix|hotfix>/<task-id>-<hyphen-separated-short-name>

Note the slash between the type of the branch and the rest of name, kind like namespacing the branches. That's done because Git actually parses the branch names and stores them in separate folders based on the slashes in the name. This has several advantages like making it easier to search features by their names in the terminal and even several GUI Git clients will organize your branches based on this nomenclature as well.

The rest of the name consists of the feature id (taken from however you are organizing your work TODO: explain a bit more about Trello, Asana, Basecamp, etc?) and a 2/3 word description of the task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment