========
GITPMOJI is a powerful AI-driven tool designed to enhance your Git workflow. It offers several key features:
-
Commit Message Generation: Analyzes your code changes (diff) and generates comprehensive commit messages, providing detailed context for each commit.
-
Code Change Evaluation: Assesses the impact and quality of your code changes, offering insights into the modifications made.
-
Emoji Decoration: Automatically adds relevant emojis to your commits, providing visual cues that make it easier to understand the nature of each change at a glance.
This multi-functional approach transforms your commit history into a more informative, insightful, and visually appealing log of your project's development. By leveraging AI to generate, evaluate, and decorate your commits, GITPMOJI helps maintain a clear and meaningful record of your project's evolution.
- When you make a commit, GITPMOJI intercepts the commit message using a Git hook. So it works with all git clients and IDEs that use git hooks.
- The commit message and diff are sent to a custom script (
gpt.sh) that communicates with the OpenAI API. - The API, using the GPT-4o model, analyzes the commit message and the diff and updates the commit message.
- The suggested emoji is prepended to your original commit message.
- The AI generates a commit message based on the diff changes added to at the end of the original commit message.
- Rating of the commit message is added to the end of the commit message.
- The process respects any existing prefix in your commit messages, as defined by the GITPMOJI_PREFIX_RX environment variable.
This process happens seamlessly, requiring no additional action from the user after initial setup.
- add ~ to the end of your commit message to let AI update the commit message and add the emoji to it
- add ~~ to the end of your commit message to let AI update the commit message based on the diff
- add ~~~ to the end of your commit message to let AI for both update the commit message and add the emoji
- add * as the last character of your commit message to let AI add the rating to the end of the commit message
- use composition like ~~~* or ~~* or ~* to let AI update the commit accordingly
GITPMOJI also provides a feature to assess the quality of your code changes. You can use the ./gpt -a command to evaluate the impact and quality of your code modifications. This command analyzes the git diff and provides a detailed assessment based on several factors such as code cleanliness, structure, readability, complexity, and overall code quality.
To use this feature, simply run:
git diff | ./gpt.sh -a -d
Navigate to your project directory and run:
curl -o install.sh https://raw.githubusercontent.com/Fl0p/gitpmoji/main/install.sh && bash install.sh && rm install.sh
and follow the instructions.
The installer will prompt you to choose where to install gitpmoji:
- Default (
.gitpmoji): Press Enter to install in a hidden.gitpmojidirectory (recommended, automatically added to.gitignore) - Project root: Enter
.to install scripts directly in your project root
The installer now supports global configuration:
- Create
~/.gitpmoji.envto store your API key and settings globally - During installation, you can choose to use global settings or override them locally
- Local
.gitpmoji.envwill source global config and can override specific values
- install jq
brew install jq
or
apt-get install jq
-
download
prepare-commit-msg.shandgpt.sh -
Create
.gitpmoji.envfile in your project root or globally at~/.gitpmoji.env:
# Your api key you can get one here https://platform.openai.com/account/api-keys
export GITPMOJI_API_KEY="your_openai_api_key"
export GITPMOJI_API_BASE_URL="https://api.openai.com/v1"
export GITPMOJI_API_MODEL="gpt-4o"
# Regex for sed command. emoji will be placed after it if found
export GITPMOJI_PREFIX_RX="TICKET-[0-9]\{1,5\} \{0,1\}"❗ Note:
- GITPMOJI_API_BASE_URL is optional and defaults to https://api.openai.com/v1
- GITPMOJI_API_MODEL is optional and defaults to gpt-4o
- Local
.gitpmoji.envcan source global~/.gitpmoji.envand override specific values
-
make sure to have
prepare-commit-msg.shandgpt.shexecutable -
create symlink in
.git/hooks/:
ln -sf ../../.gitpmoji/prepare-commit-msg.sh .git/hooks/prepare-commit-msgor if installed in project root:
ln -sf ../../prepare-commit-msg.sh .git/hooks/prepare-commit-msgSimply write your commit messages as usual. GITPMOJI will automatically add relevant emojis to your commits.
Check out the commit messages in this repo
🩹️ typos fix. fix tilda removing~
📝 Update README.md to provide a more comprehensive description of GITPMOJI features
🩹 fix emoji placement
⚰️ Remove redundant echo
♻️ Update with commit message generation
🔧 Add Prefix support and .env file
➕ Add some predefined Emojis
🛠️ Refacroring GPT script
(Add contribution guidelines here)

