All Projects → akanshgulati → commit-semantics

akanshgulati / commit-semantics

Licence: other
Commit semantics is a git aliases installation script to follow a fix format for commits

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to commit-semantics

cz-gitmoji
🔬😜 Commitizen adapter for gitmoji.
Stars: ✭ 25 (-34.21%)
Mutual labels:  commitizen, commit
nest-boilerplate
Nest.js boilerplate with CircleCI, Commitizen, Commitlint, Docker-Compose, ESLint, GitHub Actions, Husky, Lint-staged, OpenAPI, Prettier, PostGreSQL, Travis CI, TypeORM
Stars: ✭ 16 (-57.89%)
Mutual labels:  commitizen
Init
❗️ Go to the first (initial) commit of any GitHub repo
Stars: ✭ 207 (+444.74%)
Mutual labels:  commit
simple-commit-message
Simple commit message wizard and validator; works with commitizen and pre-git
Stars: ✭ 21 (-44.74%)
Mutual labels:  commitizen
fe-standard-config-seed
前端通用代码规范自动化接入
Stars: ✭ 18 (-52.63%)
Mutual labels:  commitizen
emoji-cz
✨ A commitizen emoji adapter.
Stars: ✭ 62 (+63.16%)
Mutual labels:  commitizen
Git History
Quickly browse the history of a file from any git repository
Stars: ✭ 12,676 (+33257.89%)
Mutual labels:  commit
Cz Cli
The commitizen command line utility. #BlackLivesMatter
Stars: ✭ 12,671 (+33244.74%)
Mutual labels:  commitizen
nest-js-boilerplate
Nest.js boilerplate
Stars: ✭ 79 (+107.89%)
Mutual labels:  commitizen
commitlint-config-cz
⚙️ commitlint sharable configuration, automatically converts/merges your cz-customizable (commitizen) config.
Stars: ✭ 23 (-39.47%)
Mutual labels:  commitizen
vite-vue3-starter
⭐ A Vite 2.x + Vue 3.x + TypeScript template starter
Stars: ✭ 384 (+910.53%)
Mutual labels:  commitizen
oyster-package-generator
Oyster is a package generator for Unity Package Manager (UPM). It generates a best standards Unity package with automated deployments via CLI. Focus on coding your package instead of deployments, changelogs, ect.
Stars: ✭ 18 (-52.63%)
Mutual labels:  commitizen
commitiquette
Plugin for Commitizen that uses commitLint configuration
Stars: ✭ 24 (-36.84%)
Mutual labels:  commitizen
Gitmoji Changelog
A changelog generator for gitmoji 😜
Stars: ✭ 250 (+557.89%)
Mutual labels:  commit
bash-for-developers
🎓 Tutorial completo e em português para devs iniciantes de como usar o Bash e o Git.
Stars: ✭ 97 (+155.26%)
Mutual labels:  commitizen
Add And Commit
Add & commit files from a path directly from GitHub Actions
Stars: ✭ 198 (+421.05%)
Mutual labels:  commit
cra-template-react-template
🤘 My bootstrap template to use in react
Stars: ✭ 15 (-60.53%)
Mutual labels:  commitizen
gnomit
A simple Git commit message editor for Gnome.
Stars: ✭ 30 (-21.05%)
Mutual labels:  commit
Callapp Lib
🔥call app from h5(H5唤起客户端 )
Stars: ✭ 1,857 (+4786.84%)
Mutual labels:  commitizen
lerna-learning
基于Lerna管理packages的Monorepo项目最佳实践
Stars: ✭ 105 (+176.32%)
Mutual labels:  commitizen

commit-semantics

Commit-Semantics

Inspired by Angular JS's committing style as on github, this project installs git aliases of various commit message type and helps in creating a standard of committing format.

Introduction

These are custom git commands that encourages the git user to write formatted git commit messages. These aliases will standardised git commits.

e.g. git feat install.sh 'Added commit semantics aliases' -> git commit -m 'feat(install.sh): Added commit semantics aliases'

More shorter way possible now:

e.g. gf install.sh 'Added commit semantics aliases' -> git commit -m 'feat(install.sh): Added commit semantics aliases'

Installation

  1. Clone this repo, preferably in your $HOME directory. git clone https://github.com/akanshgulati/commit-semantics.git ~/.commit-semantics

  2. Install it as git aliases: cd ~/.commit-semantics && chmod 755 install.sh && ./install.sh

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

  1. Ready to use.

Usage

Once you install, you can use 10 git aliases in following ways:

1. Only Committing

git <type> <scope> <commit-message> -> git commit -m '<type>(<scope>): <commit-message>'

e.g.

  • git feat install.sh "options in alias command" -> git commit -m 'feat(install.sh): options in alias command'
  • git docs LICENSE "update to apache 2.0 style" -> git commit -m 'docs(LICENSE): update to apache 2.0 style'
  • git chore package.json "task to uglify JS" -> git commit -m 'chore(package.json): task to uglify JS'
  • git fix app "maximum call stack issue" -> git commit -m 'fix(app): maximum call stack issue'
  • git refactor MainController "change callbacks to promises" -> git commit -m 'refactor(MainController): change callbacks to promises'
  • git style navbar "add sticky position" -> git commit -m 'style(navbar): add sticky position'
  • git test appSpec "fix test cases for init method" -> git commit -m 'test(appSpec): fix test cases for init method'
  • git perf accordion "add lazy load in thumbnails" -> git commit -m 'perf(accordion): add lazy load in thumbnails'
  • git cleanup dateFilter "remove unused dateChange method" -> git commit -m 'cleanup(dateFilter): remove unused dateChange method'
  • git tracking sidebar "add click event on links" -> git commit -m 'tracking(sidebar): add click event on links'
  1. Committing with options
  • git <type> <scope> <commit-message> [options] -> git commit [options] -m '<type>(<scope>): <commit-message>'

e.g.

  • git feat install.sh "options in alias command" a -> git commit -a -m 'feat(install.sh): options in alias command'
  • git fix app "maximum call stack issue" p -> git commit -p -m 'fix(app): maximum call stack issue'

Note: Only those options can work that precedes -m option in git commit, such as -p, -a, -s, -v, -c .

Guidelines

Selecting type


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.

  • feat: Commits related to a new feature developed
  • fix: Commits related a bug fix
  • style: Commits related to styling in .css, .scss, .etc files.
  • cleanup: Commits related to changes that do not affect the logic of the code (white-space, formatting, missing semi-colons, dead code removal, etc.)
  • refactor: Commits related to changes that neither fixes a bug nor adds a feature but is used for restructuring the code
  • perf: Commits related to changes that improves performance
  • test: Commits related to adding missing tests or fixing them
  • chore: Commits related to changes in build process, auxiliary tools and libraries such as documentation generation
  • tracking: Commits related to any kind of tracking which includes bug tracking, user tracking, analytics, etc.
  • docs: Commits related to documentation changes, such as Readme.md file

Selecting scope


The scope in commit message could be anything specifying context of the commit change. A scope context can be a module, fileName, serviceName, directiveName, functionName , impactArea, etc.

Selecting commit-message


There are certain rules that everyone should follow to commit like a pro.

  1. Limit of 50 characters
  2. Do not end the message with a period
  3. Use imperative form
  4. Use present tense

1. Limit of 50 characters

50 characters is not a hard limit, just a rule of thumb. Keeping message at this length ensures that they are readable, and forces the author to think for a moment about the most concise way to explain what’s going on. Even Github truncates any message line longer than 72 characters with an ellipsis.

If your message length increases 50 characters even after summarizing, try to adopt atomic commits pattern. You can use git add -p to get better insight of changes.

2. Do not end the message with a period

Punctuation marks at the end of message is not required as commit messages are considered as subject or titles.

3. Use imperative form

Imperative form ensures to convey the correct instruction of the commit in short and crisp form. With the current commit semantics, keeping imperative form is much easier. Few examples:

  • Pour me a glass of water.
  • Leave the package at the door.
  • Take me to the library.

You can read more about imperative form here.

4. Use present tense

Usually, we believe commit message records what we have done. But, Git is a distributed version control system where there are potentially many places to get changes from. Rather than writing messages that say what you’ve done; consider these messages as the instructions for what applying the commit will do.

For example:

Renamed the variabled for better context should be Rename the variabled for better context

Even Git generated commit messages are in present tense. For example:

Merge pull request #1 from akanshgulati/better-desc

Example

Command:

git style header 'move header on top of elements'

Output:

git commit -m "style(header): move header on top of elements"

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].