Search Header Logo
Developer Guidelines

Developer Guidelines

Assessment

Presentation

Professional Development

Professional Development

Hard

Created by

Shivam Tripathi

Used 2+ times

FREE Resource

20 Slides • 0 Questions

1

Developer Guidelines

By Shivam Tripathi, Abhishek Kannojia, Ameen Ahmed

​Git Workflow, Git Commit Messages and Code Reviews

2

Git Workflow

Developer Guidelines

Part 1: ​Git Workflow

3

Problem Statement

  • Currently, git workflows varies by teams and repositories.

  • This leads to challenges in collaboration and unnecessary context switching.

  • Goal is to establish a common git workflow across teams and repositories. ​

Git Workflow | Problem Statement

Developer Guidelines

4

Feature Branch

  • Main is the stable branch.

  • We checkout the feature branch from main branch.

Git Workflow | Feature Branch

Developer Guidelines

main

​feat/some-cool-feature

​git checkout -b feat/some-cool-feature

​checkout

5

Team Collaboration

Developer Guidelines

  • Each individual developer working on the feature will create their own branch(es) from the ​main feature branch.

  • After finishing their individual work, they can open a PR into the main feature branch.​

git checkout -b shivam/some-cool-feature

shivam/some-cool-feature

​feat/some-cool-feature

​PR

Git Workflow | Team collaboration

​feat/some-cool-feature

​Checkout

6

Dev launch

We checkout from the feature branch a dev branch named exp-dev/<feature_name> which can be connected to a CI/CD ​pipeline. For every launch, merge feature branch into the dev branch.

Git Workflow | Dev Launch

Developer Guidelines

​feat/some-cool-feature

​exp-dev/some-cool-feature

CI/CD Deployment

​git checkout -b exp-dev/some-cool-feature

7

Prod launch: Experiment

Feature branch owner will create another branch named exp/<feature_name> which will have CI/CD triggers for deployment.

Git Workflow | Prod Launch: Experiment

Developer Guidelines

​feat/some-cool-feature

​exp/some-cool-feature

CI/CD deployment

​git checkout -b exp/some-cool-feature

8

Prod Launch: 100%

Owner(s) of the feature feature branch will create PR against the main branch, which after review will be merged via Bitbucket/Github. Once merged, main will be merged into different running experiment branches with pre configured CI/CD triggers.

Git Workflow | Prod Launch: 100%

Developer Guidelines

​feat/some-cool-feature

main

​exp/exp-a

​exp/exp-b

​exp/main

​PR

9

Git WorkFlow: Summary

Git Workflow | Summary

Developer Guidelines

media

10

Part 2: Git Commit Message

Git Commit Message

Developer Guidelines

11

Problem Statement

  • Currently, git messages are unstructured and unhelpful.​

  • It is difficult to filter out which commits belonged to which features, or what exactly they changed or modified.

  • It is difficult to establish what was the intent of the commit - was it a fix, a new feature, a regular chore or something else. ​

Git Commit Message | Problem Statement

Developer Guidelines

12

Message Style

feat(mna/india): Add support for mobile number authentication in India

fix(main/circular-deps): Remove circular dependency bug

refactor(rescore/editRunningGame): Apply strategy pattern​ when extracting marks

chore(​main/node): Bump node version to v16

Git Commit Message | Message Style

Developer Guidelines

media

13

14

Part 3: Code Reviews

Code Reviews

Developer Guidelines

15

Problem Statement

  • ​Currently PRs are an after thought, leading to fat PRs.

  • Reviewing lar​ge PRs in one go is not very productive and it is not possible to do proper justice to the exercise (imagine reviewing 500+ line PR). After a point it reduces to being a formality.

  • Reviewing PRs as a part of work culture also helps in knowledge transfer for both reviewer and the person who opened the PR. ​

Code Reviews | Problem Statement

Developer Guidelines

16

Code Reviews | Social

Developer Guidelines

media

18

Code Review: Part of the process

  • Instead of opening the final PR at the end of the ​development cycle, we try to break down the feature into smaller sub tasks and regularly make incremental request for reviews which is done regularly (while rest of the development continues).

  • It is easier and faster to review 50-100 lines of code​.

Code Reviews | PR as a part of the process

Developer Guidelines

19

Code Review: Workflow

  • Individual changes should ideally be merg​ed into feature branches only via Github or Bitbucket PRs.

  • Changes from feature branches into main MUST be merged via Github or B​itbucket PRs.

  • For individual branches, developers can use merge, squash, rebase etc as per their convenience.

Code Reviews | Reviews

Developer Guidelines

20

Questions?

Developer Guidelines

Developer Guidelines

By Shivam Tripathi, Abhishek Kannojia, Ameen Ahmed

​Git Workflow, Git Commit Messages and Code Reviews

Show answer

Auto Play

Slide 1 / 20

SLIDE