• Stars
    star
    135
  • Rank 262,059 (Top 6 %)
  • Language
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Git styleguide followed by us here at Pagar.me

Git Style Guide

Git style guide suggested by Pagar.me.


Branches

  • 1.1 Choose short and descriptive names.

    Identifiers from corresponding tickets in an external service (eg. a GitHub issue) are also good candidates for use in branch names.

    # good
    $ git checkout -b feature/oauth
    
    # good: using identifiers
    $ git checkout -b fix/issue-15
    
    # bad: too vague
    $ git checkout -b login_fix
    
  • 1.2 Use dashes to separate words.

    # good
    $ git checkout -b feature/add-webhook
    
    # bad
    $ git checkout -b feature/add_webhook

Commits

  • 2.1 Each commit should represent a single logical change.

    Don't make several logical changes in one commit. For example, if a patch fixes a bug and optimizes the performance of a feature, split it into two separate commits.

    Tip: Use git add -p to interactively stage specific portions of the modified files.

  • 2.2 Don't split a single logical change into several commits.

    For example, the implementation of a feature and the corresponding tests should be in the same commit.

  • 2.3 Commit early and often.

    Small, self-contained commits are easier to understand and revert when something goes wrong.

    Tip: Use git add -p to interactively stage specific portions of the modified files.

  • 2.4 Commits should be logically sorted.

    If commit X depends on changes done in commit Y, then commit Y should come before commit X. Similarly, if commit A solves a bug introduced by commit B, it should also be stated in the message of commit A.

  • 2.5 NEVER let a commit break any working functionality.

    ALWAYS guarantee that the master branch only contains commits that are fully functional, have their own tests and fixes.

    Note: While working alone on a local branch that has not yet been pushed, it's fine to use commits as temporary snapshots of your work. However, it still holds true that you should apply all of the above before pushing it to remote. To do that it's really important to understand git rebase -i.

Messages

  • 3.1 Use the editor, not the terminal, when writing a commit message.

    Why? Committing from the terminal encourages a mindset of having to fit everything in a single line which usually results in non-informative, ambiguous commit messages.

    # good
    $ git commit
    
    # bad: no commit message
    $ git commit -m "Quick fix"
  • 3.2 A commit message consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer. The layout looks like this:

    context: subject
    
    body
    
    footer
    
    • Title: consists of the context of the message and subject.
    • Context: the part of the of the application that is being changed.
    • Subject: what is being changed. Subjects should be no greater than 50 characters, should begin with a minuscule letter and not end with a period. Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes.
    • Body: use the body to explain the what and why of a commit, not the how. When writing a body, the blank line between the title and the body is required and you should limit the length of each line to no more than 72 characters. Ultimately, when writing a commit message, think about what you would need to know if you run across the commit in a year from now.
    • Footer: the footer is optional and is used to reference issue tracker IDs.

    Example commit message:

    core: summarize changes in around 50 characters or less
    
    More detailed explanatory text, if necessary. Wrap it to about 72
    characters or so. In some contexts, the first line is treated as the
    subject of the commit and the rest of the text as the body. The
    blank line separating the summary from the body is critical (unless
    you omit the body entirely); various tools like `log`, `shortlog`
    and `rebase` can get confused if you run the two together.
    
    Explain the problem that this commit is solving. Focus on why you
    are making this change as opposed to how (the code explains that).
    Are there side effects or other unintuitive consequenses of this
    change? Here's the place to explain them.
    
    Further paragraphs come after blank lines.
    
     - Bullet points are okay, too
    
     - Typically a hyphen or asterisk is used for the bullet, preceded
       by a single space, with blank lines in between, but conventions
       vary here
    
    If you use an issue tracker, put references to them at the bottom,
    like this:
    
    Resolves: #123
    See also: #456, #789
    

Merging

  • 4.1 Do not rewrite published history.

    Why? The repository's history is valuable in its own right and it is very important to be able to tell what actually happened.

    Altering published history is a common source of problems for anyone working on the project. However, there are cases where rewriting history is legitimate. These are when:

    • You are the only one working on the branch and it is not being reviewed.
    • You want to tidy up your branch (eg. squash commits) and/or rebase it onto the "master" in order to merge it later.
  • 4.2 Keep the history clean and simple.

    Make sure it conforms to the style guide and perform any needed actions if it doesn't (squash/reorder commits, reword messages etc.).

  • 4.3 Rebase it onto the branch it's going to be merged to.

    Note: This strategy is better suited for projects with short-running branches. Otherwise it might be better to occasionally merge the "master" branch instead of rebasing onto it.

  • 4.4 NEVER commit something like "Fix linter" or "Fix tests".

    Why? These "fixes" should be squashed to the commits that originated the change.

  • 4.5 NEVER fully squash a branch before merging it.

  • 4.6 NEVER use git merge master on a branch.

    ALWAYS use git rebase master, then force-push, wait for the CI to clear and only then merge into master.

Need Help ?

If you are not familiar with git commands or need help to accomplish the style guide, check k88hudson/git-flight-rules for some usage tips and walkthrough.

More Repositories

1

superbowleto

🏈 A microservice to issue, register and manage boletos
JavaScript
595
star
2

cafe-com-testes

O Café com Testes é uma iniciativa interna da Pagar.me para compartilhar conhecimento sobre testes e boas práticas de desenvolvimento. Essa iniciativa foi inspirada no Testing on the Toilet do Google
479
star
3

pagarme-php

💙 Pagar.me's PHP API
PHP
343
star
4

lambda

🔮 Estudos obscuros de programação funcional
JavaScript
318
star
5

vagas

🤝 Venha fazer parte do nosso time
307
star
6

node-boleto

Boleto generator in Node.js
JavaScript
298
star
7

react-event-components

🛰 A set of React components designed to handle global events (interval, keyboard, touch, mouse, etc)
JavaScript
274
star
8

teleport

🍆 Trigger-based Postgres replicator in Go that works without superuser permissions
Go
233
star
9

react-style-guide

Our React Style Guide
JavaScript
155
star
10

tldr

📜 A microservice to store and display sales receipts
JavaScript
133
star
11

react-scripts-former-kit-dashboard

📊 A custom react-scripts for building highly-customizable dashboards using former-kit components
JavaScript
130
star
12

react-payment-card-component

💳 A modern credit card component for React
JavaScript
99
star
13

the-office

Escritório virtual da Pagar.me
Svelte
94
star
14

pagarme-ruby

Pagar.me's Ruby API
Ruby
80
star
15

pagarme-python

🐍 Pagar.me's Python library
Python
76
star
16

former-kit

✈️ Primitive and unstyled React components ready for receiving your own visual identity.
JavaScript
71
star
17

javascript-style-guide

🎨 Javascript styleguide followed by us here at Pagar.me
JavaScript
50
star
18

deployer

📟 A tool for fetching, building, pushing and deploying applications.
Go
47
star
19

pagarme-magento

🛒 Pagar.me's Magento plugin
PHP
46
star
20

pagarme-java

Pagar.me's Java API
Java
44
star
21

pagarme-net

Pagar.me .NET library
C#
41
star
22

artis

💳 Projeto de Checkout desenvolvido em parceria entre MundiPagg e Pagar.me.
JavaScript
40
star
23

escriba

📜 Logging on steroids
JavaScript
38
star
24

talks

🎬 Recursos e material de estudo para criar boas talks
38
star
25

business-calendar

Holiday and financial operation calendar database
CSS
31
star
26

former-kit-skin-pagarme

✈️ A skin for former-kit based on Pagar.me's brand.
CSS
25
star
27

pagarme-core-api-php

PHP
23
star
28

robrowser

🤖 Automated frontend tests in different browser stacks
JavaScript
22
star
29

pagarme-opencart

Modulo Pagar.me para OpenCart
PHP
22
star
30

edipsy

Decent EDI file parsing in Node.js
JavaScript
22
star
31

sqs-quooler

A complete queue consumer for SQS
JavaScript
21
star
32

mr-krabs

🦀 💰 A package to clear Fargate cluster tasks https://www.npmjs.com/package/mr-krabs
JavaScript
20
star
33

satan-pm

node cluster process manager, upstart friendly
JavaScript
18
star
34

biblioteca-virtual

Repositório com links para artigos, vídeos, cursos levantados pelos times
18
star
35

pagarme-nodejs-sdk

TypeScript
17
star
36

caesar-challenge

17
star
37

pagarme-ng-checkout

Angular service to provide checkout functionality to your Angularjs application.
JavaScript
16
star
38

magento2

Magento2 Module for Pagar.me 2.0
PHP
16
star
39

pagarme-pocs

Um repositório para armazenarmos todas as pocs e exemplos de códigos que fazemos.
JavaScript
15
star
40

opensource

This is a guide for sharing best practices in furtherance of our open source projects
15
star
41

pagarme-ios

Pagar.me's iOS API
Objective-C
15
star
42

cryptokit

Golang crypto wrapper with pluggable providers
Go
15
star
43

node-rsa-keygen

Native RSA keypair generator for Node
C++
14
star
44

emblematic-icons

Pagar.me's iconography
JavaScript
14
star
45

hermes

Angular.js $http wrapper for RESTful applications
JavaScript
14
star
46

cards-style-sheet

💳 A sheet of cards in CSS
CSS
14
star
47

pagarme-php-sdk

PHP
13
star
48

bifrost

🌈 Bifrost: Pagarme's bridge between browser and MPOS
C#
13
star
49

business-moment

Helpers for dealing with business days. Uses business-calendar as source.
JavaScript
13
star
50

pagarme-ng-dropdown

Pagar.me directive to provide a simple and quick dropdown from a provided array of options
JavaScript
13
star
51

p4g4rm3

Validador de senha de nossos serviços! ⛔
JavaScript
13
star
52

mpos-net-sdk

Pagar.me's mPOS SDK
C#
13
star
53

woocommerce

Woocommerce module for Pagar.me
PHP
12
star
54

papeis

Os papéis que temos no Pagar.me
11
star
55

pagarme-core-api-nodejs

JavaScript
10
star
56

dojo

Repositório para as práticas de Dojo do time de Tecnologia da Pagar.me
JavaScript
10
star
57

pagarme-ng-range

Pagar.me directive to provide a custom range element
JavaScript
9
star
58

pagarme-express-exemplo

Esse projeto é um guia do fluxo de uso das funções mais utilizadas da API do Pagar.me
JavaScript
9
star
59

pagarme-sass-styleguide

The awesome angular.js styleguide that we follow at Pagar.me
8
star
60

warp-pipe

Golang tools to handle postgres logical replication slots
Go
8
star
61

dust

⚙️ 🏜️ Grupo de estudos da linguagem Rust 🏜️ ⚙️
Rust
8
star
62

pagarme-core-api-python

Python
8
star
63

pagarme-angular-styleguide

The awesome angular.js styleguide that we follow at Pagar.me
8
star
64

pagarme-core-api-java

Java
8
star
65

pagarme-ng-tooltip

Pagar.me directive to provide simple a tooltip
JavaScript
8
star
66

pagarme-python-sdk

Python
7
star
67

deplorator

extreme secure deploy manager
JavaScript
7
star
68

brand

Pagar.me logos in optimized SVG
7
star
69

terraform-ecs-application

ECS + CODEDEPLOY integrated with canary capabilities
HCL
6
star
70

pagarme-core-api-dotnet-framework

C#
6
star
71

pagarme-developers

Pagar.me's Developer Blog
CSS
6
star
72

pinpadRNExample

Example para integração com Pinpad em React Native
JavaScript
6
star
73

livepatch

Patch JSON streams on the fly
JavaScript
6
star
74

css

✨ Estudos sobre toda a magia do CSS
5
star
75

monkeyflash

Awesome library for animation and web page automation
JavaScript
5
star
76

react-material-design-icon-components

React components for all material design icons.
JavaScript
5
star
77

bundler

Node.js private package manager
JavaScript
5
star
78

pagarme-net-standard-sdk

C#
5
star
79

pagarme-core-api-go

Go
5
star
80

pagarme-golang-sdk

Go
4
star
81

mpos-android

Exemplo de aplicação do SDK Android MPOS Pagar.me
Java
4
star
82

ecommerce-module-core

PHP Module Core for our modules
PHP
4
star
83

cluster-requiem

Enhacements for the cluster module in order to handle graceful shutdowns with jobs that aren't associated with a socket.
JavaScript
4
star
84

bluebird-ff

Bluebird functional/flow extensions
JavaScript
4
star
85

scripts-to-rule-them-all

Pagar.me's scripts to rule them all, Docker version
Shell
4
star
86

tabajara-replicator

MySQL to PostgreSQL replicator
Ruby
4
star
87

cadu-js

💚 CADU Javascript API
JavaScript
4
star
88

aws-challenges

Desafios para candidados a vagas do time infraestrutura AWS
4
star
89

pagarme-java-sdk

Java
4
star
90

arcaneshield

Python
4
star
91

ecs-task-def-replacements

JavaScript
4
star
92

pagarme-prestashop

Pagar.me - Prestashop Module
Smarty
4
star
93

barcode-backup

Please, do not use this repository for production it is for reference only! Thank you!
JavaScript
3
star
94

gulp-ngspec

Hard file management for gulp projects
JavaScript
3
star
95

elasticrecord

ElasticSearch trait for ORMs, batteries included.
JavaScript
3
star
96

post-mortem-reports

Outage post mortem reports
3
star
97

pagarme-core-api-dotnet-standard

C#
3
star
98

lambda-simple-deploy

💿 Package and update your existent AWS Lambda functions
JavaScript
3
star
99

moment

Moment proxy usando a TZ de America/Sao_Paulo
JavaScript
3
star
100

saphire

Ruby inspired type system for JavaScript
JavaScript
2
star