|
| 1 | +<p align="center"> |
| 2 | + <a href="https://github.com/akanshgulati/commit-semantics" align="center"> |
| 3 | + <img src="commit-semantics-banner.jpg" alt="commit-semantics" align="center" /> |
| 4 | + </a> |
| 5 | +</p> |
| 6 | + |
| 7 | +# Commit-Semantics |
| 8 | + |
| 9 | +Inspired by Angular JS's committing style as on [github](https://github.com/angular/angular/commits/master), this project installs git aliases of various commit message type and helps in creating a standard of committing format. |
| 10 | + |
| 11 | +## Introduction |
| 12 | +These are **custom git commands** that encourages the git user to write formatted git commit messages. These aliases will standardised git commits. |
| 13 | + |
| 14 | + e.g. ```git feat install.sh 'Added commit semantics aliases'``` -> ```git commit -m 'feat(install.sh): Added commit semantics aliases'``` |
| 15 | + |
| 16 | + More shorter way possible now: |
| 17 | + |
| 18 | + e.g. ```gf feat install.sh 'Added commit semantics aliases'``` -> ```git commit -m 'feat(install.sh): Added commit semantics aliases'``` |
| 19 | +## Installation |
| 20 | + |
| 21 | +1. Clone this repo, preferably in your $HOME directory. ```git clone [email protected]:akanshgulati/commit-semantics.git |
| 22 | + ~/.commit-semantics``` |
| 23 | + |
| 24 | + |
| 25 | +2. Install it as git aliases: |
| 26 | + ```cd ~/.commit-semantics && chmod 755 install.sh && ./install.sh``` |
| 27 | + |
| 28 | + Tip: You can check if aliases are created in `~/.gitconfig` file respectively. Aliases will be created only if no respective alias is present in `~/.gitconfig` file |
| 29 | + |
| 30 | +3. Ready to use. |
| 31 | + |
| 32 | +## Usage |
| 33 | + |
| 34 | +Once you install, you can have 10 git aliases. |
| 35 | + |
| 36 | +Git alias -> Actual command |
| 37 | + |
| 38 | +* ```git feat <scope> "commit-message-here"``` -> ```git commit -m 'feat(<scope>): commit-message-here'``` |
| 39 | +* ```git docs <scope> "commit-message-here"``` -> ```git commit -m 'docs(<scope>): commit-message-here'``` |
| 40 | +* ```git chore <scope> "commit-message-here"``` -> ```git commit -m 'chore(<scope>): commit-message-here'``` |
| 41 | +* ```git fix <scope> "commit-message-here"``` -> ```git commit -m 'fix(<scope>): commit-message-here'``` |
| 42 | +* ```git refactor <scope> "commit-message-here"``` -> ```git commit -m 'refactor(<scope>): commit-message-here'``` |
| 43 | +* ```git style <scope> "commit-message-here"``` -> ```git commit -m 'style(<scope>): commit-message-here'``` |
| 44 | +* ```git test <scope> "commit-message-here"``` -> ```git commit -m 'test(<scope>): commit-message-here'``` |
| 45 | +* ```git perf <scope> "commit-message-here"``` -> ```git commit -m 'perf(<scope>): commit-message-here'``` |
| 46 | +* ```git cleanup <scope> "commit-message-here"``` -> ```git commit -m 'cleanup(<scope>): commit-message-here'``` |
| 47 | +* ```git tracking <scope> "commit-message-here"``` -> ```git commit -m 'tracking(<scope>): commit-message-here'``` |
| 48 | + |
| 49 | +## Guidelines |
| 50 | +### Selecting `type` |
| 51 | +Different types of `type` are there according to make sure one can get idea about the core reason of commit message. Current script supports following types of commits. |
| 52 | + |
| 53 | +* **feat**: Commits related to a new feature developed |
| 54 | +* **fix**: Commits related a bug fix |
| 55 | +* **style**: Commits related to styling in .css, .scss, .etc files. |
| 56 | +* **cleanup**: Commits related to changes that do not affect the logic of the code (white-space, formatting, missing |
| 57 | + semi-colons, dead code removal, etc.) |
| 58 | +* **refactor**: Commits related to changes that neither fixes a bug nor adds a feature but is used for restructuring the code |
| 59 | +* **perf**: Commits related to changes that improves performance |
| 60 | +* **test**: Commits related to adding missing tests or fixing them |
| 61 | +* **chore**: Commits related to changes in build process, auxiliary tools and libraries such as documentation |
| 62 | +generation |
| 63 | +* **tracking**: Commits related to any kind of tracking which includes bug tracking, user tracking, analytics, etc. |
| 64 | +* **docs**: Commits related to documentation changes, such as Readme.md file |
| 65 | + |
| 66 | +### Selecting `scope` |
| 67 | + |
| 68 | +The scope in commit message could be anything specifying context of the commit change. A scope context can be a `module`, |
| 69 | +`fileName`, `serviceName`, `directiveName`, `functionName` , `impactArea`, etc. |
| 70 | + |
| 71 | +## Example |
| 72 | + |
| 73 | +##### **Command**: |
| 74 | +git refactor header 'change z-index' |
| 75 | +##### **Output**: |
| 76 | +git commit -m "refactor(header): change z-index" |
| 77 | + |
| 78 | + |
0 commit comments