Skip to content

A Zsh plugin that simplifies git commits with emoji-powered commands like <gfeat> and <gfix> for faster, more readable version control. πŸš€

License

Notifications You must be signed in to change notification settings

ashsajal1/git-commit-shortcuts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Git Commit Shortcuts

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

  1. Copy the script to your home directory:

    cp git-commit-shortcuts.zsh ~/.git-commit-shortcuts.zsh
  2. Add this line to your ~/.zshrc:

    source ~/.git-commit-shortcuts.zsh
  3. 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 add line.
  • 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.

About

A Zsh plugin that simplifies git commits with emoji-powered commands like <gfeat> and <gfix> for faster, more readable version control. πŸš€

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages