From bb72245bce044dbbc3bbba6f4bb62c6e6d0045bd Mon Sep 17 00:00:00 2001 From: kshitij-k-osmosys Date: Sun, 2 Feb 2025 19:26:16 +0530 Subject: [PATCH 1/7] docs: update git standards --- coding-standards/git.md | 226 ++++++++++++++++++++++++++++++++++------ 1 file changed, 195 insertions(+), 31 deletions(-) diff --git a/coding-standards/git.md b/coding-standards/git.md index decefc1..273a4b0 100644 --- a/coding-standards/git.md +++ b/coding-standards/git.md @@ -1,56 +1,153 @@ -Git Standards Document -====================== +# Git Standards Document -Introduction: ------------------ +- [Git Standards Document](#git-standards-document) + - [Introduction](#introduction) + - [Git Configuration](#git-configuration) + - [Repository Structure](#repository-structure) + - [Commit Messages](#commit-messages) + - [Commit Message Format](#commit-message-format) + - [Type](#type) + - [Subject](#subject) + - [Body](#body) + - [Footer](#footer) + - [Commit Message Samples](#commit-message-samples) + - [Revert](#revert) + - [Commit Granularity](#commit-granularity) + - [Pull Requests (PRs)](#pull-requests-prs) + - [Submitting a Pull Request (PR)](#submitting-a-pull-request-pr) + - [After your pull request is merged](#after-your-pull-request-is-merged) + - [Code Reviews](#code-reviews) + - [Conflict Resolution](#conflict-resolution) + - [Tagging and Releases](#tagging-and-releases) + - [Conclusion](#conclusion) + +## Introduction This document outlines the standards and conventions for using Git within our company. Adhering to these standards ensures consistency, clarity, and efficiency in managing and collaborating on projects. -Git Configuration: ----------------------- +## Git Configuration - Username and Email: Ensure your Git configuration is set with your real name and work email. ```bash - git config --global user.name "Your Name" + git config --global user.name "Your Name" git config --global user.email "your.email@company.com" ``` -Repository Structure: -------------------------- +## Repository Structure -- Master/Main Branch: +- Main/Master Branch: - Try to have `main` branch instead of `master`. - The `main` branch should always be deployable. - All commits on `main` should be made through pull requests. - Development Branch: - Use a `development` or `dev` branch for integration and testing. -- Set branch protection rules for `main` and `development` branches to restrict developers to push unverified changes and allow only maintainers to push/merge. Here is the quick read on how to set branch protection rules - https://docs.gitlab.com/ee/user/project/protected_branches.html +- Set branch protection rules for `main` and `development` branches to restrict developers to push unverified changes and allow only maintainers to push/merge. Here is the quick read on how to set branch protection rules + - github: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule + - gitlab: https://docs.gitlab.com/ee/user/project/protected_branches.html - Feature Branches: - Create separate branches for individual features or bug fixes. - Name them descriptively, e.g., `feature/user-authentication`, `bugfix/password-reset`. -Commit Messages: --------------------- +## Commit Messages - Write clear, concise, and descriptive commit messages. - Use the imperative mood ("add" instead of "added"). - Start with a capital letter. -- Do not end the commit message with a period. +- Do not end the commit message with a period. - Example: `Add user authentication` -- Always put your commit message in the below context & frame a proper message like this, +- Always put your commit message in the below context & frame a proper message like this, - If applied this commit will, \ - Example 1: `Add validation to the email field` - Example 2: `Update get users API response with lastname` -Commit Granularity: ------------------------ +### Commit Message Format + +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: + +``` +: + + + +