{"id":26129819,"url":"https://github.com/tal7aouy/commitcraft","last_synced_at":"2025-03-10T19:59:19.031Z","repository":{"id":272481796,"uuid":"916740695","full_name":"tal7aouy/CommitCraft","owner":"tal7aouy","description":"👷 Commit Best Practices — A Guide for Software Engineers","archived":false,"fork":false,"pushed_at":"2025-01-14T17:26:50.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T19:08:29.201Z","etag":null,"topics":["best-practices","clean-commit-history","commit","git-commit","software-development"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tal7aouy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-14T17:15:59.000Z","updated_at":"2025-01-14T17:26:24.000Z","dependencies_parsed_at":"2025-01-14T19:08:32.807Z","dependency_job_id":"aec0b142-ffeb-4a02-ae22-e162c6937ac7","html_url":"https://github.com/tal7aouy/CommitCraft","commit_stats":null,"previous_names":["tal7aouy/commitcraft"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2FCommitCraft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2FCommitCraft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2FCommitCraft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tal7aouy%2FCommitCraft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tal7aouy","download_url":"https://codeload.github.com/tal7aouy/CommitCraft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242918585,"owners_count":20206519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["best-practices","clean-commit-history","commit","git-commit","software-development"],"created_at":"2025-03-10T19:59:18.541Z","updated_at":"2025-03-10T19:59:19.022Z","avatar_url":"https://github.com/tal7aouy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Commit Best Practices — A Guide for Software Engineers\n\nThis guide provides best practices for writing clean, meaningful, and efficient commit messages. It covers various scenarios, from ideal commits to common mistakes, helping you communicate effectively through your version control history. The guide also includes Git best practices and tips on using emojis to enhance readability and improve team communication.\n\n---\n\n## Table of Contents\n\n1. [Why Write Good Commit Messages?](#why-write-good-commit-messages)  \n2. [Anatomy of a Great Commit Message](#anatomy-of-a-great-commit-message)  \n3. [Git Best Practices for Commit Messages](#git-best-practices-for-commit-messages)  \n4. [Commit Message Templates](#commit-message-templates)  \n5. [Using Emojis in Commit Messages](#using-emojis-in-commit-messages)  \n6. [Examples for Various Scenarios](#examples-for-various-scenarios)  \n   - [Adding Features](#adding-features)  \n   - [Fixing Bugs](#fixing-bugs)  \n   - [Improving Documentation](#improving-documentation)  \n   - [Refactoring Code](#refactoring-code)  \n   - [Handling Rollbacks](#handling-rollbacks)  \n   - [Addressing Technical Debt](#addressing-technical-debt)  \n   - [Performance Improvements](#performance-improvements)  \n   - [Security Updates](#security-updates)  \n   - [Dependency Management](#dependency-management)  \n7. [Commit Message Conventions by Team Size](#commit-message-conventions-by-team-size)  \n8. [Automated Commit Validation](#automated-commit-validation)  \n9. [Branch Naming Conventions](#branch-naming-conventions)\n\n---\n\n## 1. Why Write Good Commit Messages?\n\n- **Improves collaboration:** Helps team members understand the purpose and context of changes.  \n- **Enhances code reviews:** Clear commit messages make it easier to review changes.  \n- **Facilitates debugging:** Precise messages provide context for tracing issues.  \n- **Supports project history:** Helps maintain a clear and meaningful Git log.\n\n---\n\n## 2. Anatomy of a Great Commit Message\n\n### Structure:\n\n1. **Subject line** (short, 50 characters or less):  \n   - Summarize the change.  \n   - Use the imperative mood (e.g., \"Add,\" \"Fix,\" \"Refactor\").  \n\n2. **Body** (optional but recommended, 72 characters per line):  \n   - Explain *why* the change was made.  \n   - Highlight *what* changed.  \n   - Discuss *how* the change was implemented.  \n\n3. **Footer** (optional):  \n   - Reference issues (e.g., \"Closes #123\").  \n   - Mention breaking changes or other critical notes.  \n\n---\n\n## 3. Git Best Practices for Commit Messages\n\n- Commit small, **atomic changes** for clarity.  \n- Use **branch names** that reflect the purpose of the changes.  \n- **Rebase** before merging to keep history clean.  \n- Write commit messages that provide meaningful context, avoiding vague terms like \"fix\" or \"update.\"  \n- Avoid committing directly to the main branch.  \n\n---\n\n## 4. Commit Message Templates\n\n### Standard Template:\n```\n\u003ctype\u003e: \u003csubject\u003e\n\n\u003cbody\u003e\n\n\u003cfooter\u003e\n```\n\n### Example:\n```\nfeat: Add user authentication module\n\nImplement user login and registration functionality using OAuth.\nInclude unit tests for all authentication endpoints.\n\nCloses #42\n```\n\n---\n\n## 5. Using Emojis in Commit Messages\n\nEmojis improve readability and convey intent quickly. Below is a suggested list:\n\n- 💡 `:bulb:` – Idea or suggestion.  \n- 🔧 `:wrench:` – Fix or maintenance.  \n- ⚙️ `:gear:` – Configuration changes.  \n- ✨ `:sparkles:` – New features.  \n- 🛠️ `:hammer_and_wrench:` – Refactoring.  \n- ⚠️ `:warning:` – Breaking changes.  \n- 🔨 `:construction:` – Work in progress (WIP).  \n- 📈 `:chart_with_upwards_trend:` – Performance improvements.  \n\n### Usage Example:\n```\n✨ feat: Add dark mode toggle\n\nImplement a dark mode toggle button with local storage support.\n```\n\n---\n\n## 6. Examples for Various Scenarios\n\n### Adding Features:\n```\n✨ feat: Add user profile page\n\nIntroduce a user profile page with editable fields.\nInclude validation for all inputs.\n```\n\n### Fixing Bugs:\n```\n🔧 fix: Resolve crash on startup\n\nFix an issue where the app crashes on startup due to null pointer dereference.\nAdd null checks to the initialization sequence.\n```\n\n### Improving Documentation:\n```\n📖 docs: Update README for installation instructions\n\nAdd a detailed guide for setting up the project locally.\nInclude common troubleshooting steps.\n```\n\n### Refactoring Code:\n```\n🛠️ refactor: Simplify database query logic\n\nRefactor query builder for better readability and performance.\nReplace raw SQL queries with ORM methods.\n```\n\n### Handling Rollbacks:\n```\n⚠️ revert: Revert \"Add user analytics\"\n\nRollback analytics module due to compliance concerns.\nOriginal commit hash: abc123.\n```\n\n### Addressing Technical Debt:\n```\n🔧 chore: Remove unused dependencies\n\nClean up unused npm dependencies to reduce project size.\n```\n\n### Performance Improvements:\n```\n📈 perf: Optimize image loading algorithm\n\nImplement lazy loading for images to improve initial page load.\nReduce memory usage by 40%.\nBundle size decreased by 250KB.\n```\n\n### Security Updates:\n```\n🔒 security: Update authentication tokens\n\nImplement JWT token rotation.\nAdd rate limiting for login attempts.\nCloses #234.\n```\n\n### Dependency Management:\n```\n📦 deps: Update core dependencies\n\nUpdate React to v18.2.0.\nUpgrade TypeScript to 4.9.5.\nFix security vulnerabilities in dev dependencies.\n```\n\n---\n\n## 7. Commit Message Conventions by Team Size\n\n- **Small teams:** Focus on detailed descriptions, as fewer people share the context.  \n- **Large teams:** Adhere strictly to templates and conventions to ensure clarity across diverse contributors.  \n\n---\n\n## 8. Automated Commit Validation\n\n- **Leverage hooks:** Use Git hooks to enforce message style (e.g., via `commitlint`).  \n- **Automate checks:** Integrate tools like Husky or Prettier to streamline workflows.  \n\n---\n\n## 9. Branch Naming Conventions\n\n### Pattern\n```\n\u003ctype\u003e/\u003cticket-number\u003e-\u003cshort-description\u003e\n```\n\n### Examples\n- `feature/PROJ-123-user-authentication`  \n- `bugfix/PROJ-456-fix-memory-leak`  \n- `hotfix/PROJ-789-critical-security-patch`  \n\n---\n\nBy following these best practices, you’ll write commit messages that enhance team collaboration, improve project history, and maintain a clean Git workflow.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftal7aouy%2Fcommitcraft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftal7aouy%2Fcommitcraft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftal7aouy%2Fcommitcraft/lists"}