Git Aliases for Conventional Commits
Helpful aliases to enforce Juniro's Conventional Commits standards
🎯 Quick Setup
Add these aliases to your global git config to make conventional commits easier:
# Set up all aliases at once
git config --global alias.cf 'commit -m "feat: "'
git config --global alias.cx 'commit -m "fix: "'
git config --global alias.cd 'commit -m "docs: "'
git config --global alias.ct 'commit -m "test: "'
git config --global alias.cr 'commit -m "refactor: "'
git config --global alias.cc 'commit -m "chore: "'
git config --global alias.cp 'commit -m "perf: "'
git config --global alias.cs 'commit -m "style: "'
📋 Usage Examples
Basic Usage
# Instead of: git commit -m "add new blog feature"
git cf "add internal blog functionality"
# Instead of: git commit -m "update documentation"
git cd "update git templates with conventional commits"
# Instead of: git commit -m "fix broken link"
git cx "resolve broken sidebar navigation links"
With Scope
# Add scope manually for better organization
git cf "(blog): add internal team blog functionality"
git cd "(infrastructure): define hybrid hosting strategy"
git cx "(sidebar): resolve navigation link issues"
🏗️ Common Scopes for Juniro Docs
Use these scopes to organize commits by area:
Documentation Areas
(docs)- General documentation updates(sidebar)- Navigation and sidebar changes(prompts)- AI prompt management(blog)- Blog-related changes
Technical Areas
(infrastructure)- Architecture and hosting docs(design-system)- Design system documentation(api)- API documentation and specs(security)- Security and compliance docs
Business Areas
(sales)- Sales documentation and materials(product)- Product strategy and roadmap(growth)- Growth and GTM documentation(compliance)- Legal and compliance docs
🎨 Advanced Git Aliases
Interactive Commit Helper
# Add this function to your .bashrc or .zshrc
function gci() {
echo "Select commit type:"
echo "1) feat - New feature"
echo "2) fix - Bug fix"
echo "3) docs - Documentation"
echo "4) test - Tests"
echo "5) refactor - Code refactoring"
echo "6) chore - Build/dependencies"
echo "7) perf - Performance"
echo "8) style - Formatting"
read -p "Type (1-8): " type_choice
read -p "Scope (optional): " scope
read -p "Description: " desc
case $type_choice in
1) type="feat" ;;
2) type="fix" ;;
3) type="docs" ;;
4) type="test" ;;
5) type="refactor" ;;
6) type="chore" ;;
7) type="perf" ;;
8) type="style" ;;
*) echo "Invalid choice"; return 1 ;;
esac
if [ -n "$scope" ]; then
git commit -m "$type($scope): $desc"
else
git commit -m "$type: $desc"
fi
}
Validation Alias
# Check if last commit follows conventional format
git config --global alias.check-commit '!git log -1 --pretty=format:"%s" | grep -E "^(feat|fix|docs|test|refactor|chore|perf|style)(\(.+\))?: .+" && echo " ✅ Valid conventional commit" || echo " ❌ Invalid commit format"'
📊 Commit Statistics
# See breakdown of commit types
git config --global alias.commit-stats '!git log --oneline | grep -oE "^[a-f0-9]+ (feat|fix|docs|test|refactor|chore|perf|style)" | cut -d" " -f2 | sort | uniq -c | sort -nr'
✅ Verification Commands
# Check recent commits follow format
git log --oneline -10 | grep -E "(feat|fix|docs|test|refactor|chore|perf|style)(\(.+\))?: "
# Count conventional vs non-conventional commits
git log --oneline | wc -l && git log --oneline | grep -E "(feat|fix|docs|test|refactor|chore|perf|style)(\(.+\))?: " | wc -l
These aliases help maintain consistency with Juniro's git standards and make conventional commits effortless.