Skip to content

Instantly share code, notes, and snippets.

@sergii-frost
Created July 25, 2017 14:25
Show Gist options
  • Save sergii-frost/b431b5a6a940c25ffe6a6bfced928958 to your computer and use it in GitHub Desktop.
Save sergii-frost/b431b5a6a940c25ffe6a6bfced928958 to your computer and use it in GitHub Desktop.
Git best practices

It makes much easier to switch between different git projects if we try to follow similar rules for commits, branches and other git related stuff.

So, based on best practices used in different mobile projects we've come to some basic rules:

Git commits prefixes:

We are trying to make it easy to read commits history. To make commits look similar in different project / from different people some best practices can be applied:

  • adding prefix to commit:
    • [DEV] for developer related tasks (setting up CI, making configuration changes in the project etc)
    • [REF] for refactoring related tasks
    • [ADD] for adding new classes (which serve special needs, e.g. MessageHelper, Logger etc)
    • [DEL] for deleting unused classes/files/assets ([DEV] can be used as well)
    • [UI] for UI related code
    • [CRASH] for crash fix
    • [FIX] | [BUG] for bug fix
  • commit message should explain what is done/fixed/implemented and why (or what it is related to).

Examples:

**Preferred: **

[DEV] adding HockeyApp integration to be able to upload builds via command line on Jenkins
[FIX] fixing logic of checking if Date is today to highlight todays data correctly
[UI] adding new storyboard/layout for Login view

Not preferred:

HockeyApp sdk
isToday fix
new layout

Git branches:

Branches can be named based on what will be done in them:

  • feature/... for feature related branches
  • fix/... for bug fix related branches
  • crash/... for crash fix related branches
  • dev/... for dev tasks or refactoring
  • more to be added on demand

TBD

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