This repository contains a collection of useful code snippets for various usage.
- [Git Conventional Commits] (#git-conventional-commits)
A collection of git aliases to help enforce conventional commit messages and keep consistency across git history.
Individual commit aliases:
git commit-fix "message" # [FIX] : message
git commit-feat "message" # [FEAT] : message
git commit-doc "message" # [DOC] : message
git commit-ref "message" # [REFACTOR] : message
git commit-chore "message" # [CHORE] : message
git commit-test "message" # [TEST] : message
git commit-style "message" # [STYLE] : message
git commit-perf "message" # [PERF] : message
git commit-build "message" # [BUILD] : message
git commit-ci "message" # [CI] : message
git commit-revert "message" # [REVERT] : messageGeneric alias:
git cm <type> "message"
# Supported types: fix, feat, docs, refactor, chore, test, style, perf, build, ci, revertAdditional shortcuts:
git amend # Amend last commit without changing the messageThese commands create commit messages with the following format:
[TYPE] : message
Examples:
git commit-fix "fix NPE on upload" # Creates: [FIX] : fix NPE on upload
git cm feat "add pagination on /users" # Creates: [FEAT] : add pagination on /users
git cm refactor "isolate UserSync service" # Creates: [REFACTOR] : isolate UserSync serviceYou can install these aliases by running the following command in your terminal:
curl -fsSL https://raw.githubusercontent.com/Alexy-vda/snippets/main/scripts/setup-git-commit-aliases.sh \
| sh -s -- --globalOptions:
--global: Install aliases in global git config (~/.gitconfig) - default--local: Install aliases in local git config (./.git/config)--force: Overwrite existing aliases if they exist
Examples:
# Install globally (default)
curl -fsSL https://raw.githubusercontent.com/Alexy-vda/snippets/main/scripts/setup-git-commit-aliases.sh | sh -s -- --global
# Install locally in a specific repository
cd /path/to/your/repo
curl -fsSL https://raw.githubusercontent.com/Alexy-vda/snippets/main/scripts/setup-git-commit-aliases.sh | sh -s -- --local
# Force overwrite existing aliases
curl -fsSL https://raw.githubusercontent.com/Alexy-vda/snippets/main/scripts/setup-git-commit-aliases.sh | sh -s -- --global --force