|
| 1 | +# 📌 Git Branch Naming Convention (Aligned with Angular Guideline) |
| 2 | + |
| 3 | +# 📖 Introduction |
| 4 | + |
| 5 | +### To maintain a clean commit history and improve team collaboration, we follow Angular Conventional Commits in our Git branch naming. This approach makes it easy to identify change types and automate release processes. |
| 6 | + |
| 7 | +# 🚀 Branch Naming Format |
| 8 | + |
| 9 | +### The branch name should follow the format: |
| 10 | + |
| 11 | +```bash |
| 12 | +<type>/<issue-id>-<short-description> |
| 13 | + |
| 14 | +type – type of change (inspired by Angular Commit Message Convention). |
| 15 | + |
| 16 | +issue-id – task or issue ID (optional but recommended). |
| 17 | + |
| 18 | +short-description – a brief description of the change. |
| 19 | + |
| 20 | +``` |
| 21 | + |
| 22 | +# 📌 Available Types (type) |
| 23 | + |
| 24 | +### We use the following types to categorize changes: |
| 25 | +```bash |
| 26 | +| Type --- Purpose |
| 27 | +| feat --- Adding a new feature |
| 28 | +| fix --- Fixing a bug or issue |
| 29 | +| refactor --- Code refactoring without changing functionality |
| 30 | +| perf --- Performance improvements |
| 31 | +| test --- Adding or updating tests |
| 32 | +| chore --- Updating configurations, tools, or dependencies |
| 33 | +| docs --- Updating or adding documentation |
| 34 | +| style --- Code style changes (formatting, indentation, comments) |
| 35 | +| ci --- Changes in CI/CD pipeline |
| 36 | +| build --- Updates in build process or dependencies |
| 37 | +| revert --- Reverting previous changes |
| 38 | +``` |
| 39 | + |
| 40 | +# 📝 Branch Naming Examples |
| 41 | + |
| 42 | +### Here are some examples of branch names: |
| 43 | +```bash |
| 44 | +* feat/1234-add-user-authentication |
| 45 | +* fix/5678-fix-login-bug |
| 46 | +* refactor/4321-optimize-api-calls |
| 47 | +* docs/7890-update-readme |
| 48 | +* test/8765-add-e2e-tests-for-dashboard |
| 49 | + |
| 50 | +``` |
| 51 | +# 🛠 Example of Creating a Branch: |
| 52 | + |
| 53 | +### To create a new branch, use the following command: |
| 54 | +```bash |
| 55 | +git checkout -b feat/1234-add-user-authentication |
| 56 | + |
| 57 | +``` |
| 58 | + |
| 59 | +# 🏆 Best Practices |
| 60 | + |
| 61 | +* ✅ Use short and clear descriptions in branch names. |
| 62 | +* ✅ Follow a consistent style across all branches for better project structure. |
| 63 | +* ✅ Avoid redundant words, e.g., fix/1234-fix-bug (the word "fix" is redundant). |
| 64 | +* ✅ Use kebab-case (- instead of _ or CamelCase). |
| 65 | +* ✅ If there is no issue ID, omit it, e.g., docs/update-contributing-guide. |
| 66 | + |
| 67 | +# 🔗 Additional Resources |
| 68 | + |
| 69 | +**Conventional Commits**: https://www.conventionalcommits.org |
| 70 | + |
| 71 | +**Angular Commit Guidelines**: https://github.com/angular/angular/blob/main/CONTRIBUTING.md |
| 72 | + |
| 73 | +**Git Flow**: https://nvie.com/posts/a-successful-git-branching-model/ |
| 74 | + |
| 75 | +# This branch naming strategy ensures better traceability and improves commit history readability. 🚀 |
| 76 | + |
| 77 | +# 📝 Commit Message Formatting |
| 78 | + |
| 79 | +To ensure clear and structured commit messages, we follow the Conventional Commit format: |
| 80 | + |
| 81 | +🔹 **Commit Message Structure** |
| 82 | + |
| 83 | +```bash |
| 84 | +<type>(<scope>): <short description> |
| 85 | + |
| 86 | +[optional body] |
| 87 | + |
| 88 | +[optional footer] |
| 89 | + |
| 90 | +type – The type of change (e.g., feat, fix, docs, style, etc.). |
| 91 | + |
| 92 | +scope – A short context describing the part of the project affected (optional but recommended). |
| 93 | + |
| 94 | +short description – A concise summary of the change (in imperative form, e.g., "fix login bug"). |
| 95 | + |
| 96 | +body – A more detailed explanation of the change (if necessary). |
| 97 | + |
| 98 | +footer – Additional metadata, e.g., references to issues (Closes #123). |
| 99 | +``` |
| 100 | +
|
| 101 | +# 📌 Example Commit Messages |
| 102 | +
|
| 103 | +```bash |
| 104 | + |
| 105 | +feat(auth): add user authentication flow |
| 106 | + |
| 107 | +Implemented login, registration, and session handling. |
| 108 | +Closes #1234. |
| 109 | + |
| 110 | +fix(ui): resolve button alignment issue |
| 111 | + |
| 112 | +Fixed misalignment of buttons in the settings panel. |
| 113 | + |
| 114 | +docs(readme): update installation instructions |
| 115 | + |
| 116 | +Clarified step-by-step setup instructions for the project. |
| 117 | + |
| 118 | +``` |
| 119 | +
|
| 120 | +# 🔗 Additional Resources |
| 121 | +
|
| 122 | +Conventional Commits: https://www.conventionalcommits.org |
| 123 | +
|
| 124 | +Angular Commit Guidelines: https://github.com/angular/angular/blob/main/CONTRIBUTING.md |
| 125 | +
|
| 126 | +Git Flow: https://nvie.com/posts/a-successful-git-branching-model/ |
| 127 | +
|
| 128 | +This branch naming and commit message strategy ensures better traceability and improves commit history readability. 🚀 |
| 129 | +
|
0 commit comments