Git Commit Shortcuts
November 3, 2025 ยท View on GitHub
A convenient Zsh script that provides shortcuts for creating standardized git commit messages with emoji prefixes and consistent formatting.
Installation
One-line installation
Run this single command to install and set up everything automatically:
bash -c "git clone https://github.com/ashsajal1/git-commit-shortcuts.git ~/.git-commit-shortcuts && cp ~/.git-commit-shortcuts/git-commit-shortcuts.zsh ~/.git-commit-shortcuts.zsh && echo 'source ~/.git-commit-shortcuts.zsh' >> ~/.zshrc && source ~/.zshrc && echo -e '\\n\\033[0;32mโ
Git Commit Shortcuts installed successfully! Run ghelp to see available commands.\\033[0m'"
Manual Installation
-
Copy the script to your home directory:
cp git-commit-shortcuts.zsh ~/.git-commit-shortcuts.zsh -
Add this line to your
~/.zshrc:source ~/.git-commit-shortcuts.zsh -
Reload your shell configuration:
source ~/.zshrc
Available Commands
| Command | Emoji | Description |
|---|---|---|
gfeat | โจ | New feature |
gfix | ๐ | Bug fix |
gdocs | ๐ | Documentation changes |
gstyle | ๐ | Code style/formatting |
grefactor | โป๏ธ | Code refactoring |
gperf | โก | Performance improvements |
gtest | โ | Adding or updating tests |
gchore | ๐ง | Maintenance tasks |
gbuild | ๐๏ธ | Build system changes |
gci | ๐ | CI/CD configuration changes |
grevert | โช | Revert previous commits |
greset | ๐ | Soft reset to previous commit (HEAD~1 by default) |
Usage
Reset Command
Soft reset to the previous commit (HEAD~1) or a specified commit:
# Reset to previous commit
greset
# Reset to a specific commit
greset abc123
# Reset 2 commits back
greset HEAD~2
Basic Usage (with subject)
gfeat add login button
# Commits with message: "โจ feat: add login button"
# With multi-word subject (use quotes)
gfix "resolve issue with user authentication"
Interactive Mode (prompted subject)
gdocs
# Will prompt: "Commit subject for ๐ docs: "
# Type your subject and press Enter
With Multi-line Body
You can add a detailed commit message body using pipes or file redirection:
# Using pipe
echo $'Detailed description\n\n- Added new API endpoint\n- Updated documentation' | gfeat implement user authentication
# Using file redirection
grefactor improve code structure < changes.txt
View Available Commands
ghelp
Notes
- The script automatically stages all changes (
git add -A) before committing. - To modify this behavior, edit the script and remove or change the
git addline. - All commit messages follow the format:
[EMOJI] type: subject
Customization
You can customize the commit types and their corresponding emojis by modifying the types_map array in the script.