@tusharkamra/commitly v1.0.5
Commitly - Git Commit Message Generator ๐
Commitly is an npm package that uses AI to automatically generate clear and concise commit messages based on your staged changes. With just one click, it analyzes the differences in your code and creates an informative commit title and description, helping you save time and maintain consistent commit message standards. Perfect for developers who want to streamline their workflow and improve version control practices!
Features
- Automatically generates Git commit messages based on staged changes.
- Uses AI's model for generating natural language commit messages.
- Commits the changes to the repository with the generated message.
- Easily configurable using a
.env
file to store API keys and Git credentials.
Installation
Prerequisites
Make sure you have the following installed:
Install the npm package
npm install -g @tusharkamra/commitly
Set Up Environment Variables
To securely store your AI API key and other credentials, you'll need to create a .env
file in your project. The package will load the environment variables from this file.
Edit the .env file with your credentials: Open .env in a text editor and set the following variables:
AI_MODEL_URI=your-ai-model-api-uri
AI_MODEL_NAME=ai-model-name
AI_MODEL_API_KEY=ai-model-api-key
AI_MODEL_MAX_TOKEN=ai-model-max-token
Make sure
.env
is not pushed to version control by adding it to.gitignore
(if itโs not already there)
Usage
Follow these steps to use the package effectively for creating and committing changes:
Make Changes to Your Code:
- Modify the files in your project as needed.
Stage Your Changes:
- Add the modified files to the staging area using the
git add
command:
This stages all your changes. You can also stage specific files by replacinggit add .
.
with the filename:git add filename
- Add the modified files to the staging area using the
Run the Command:
- Use the package's command
commitly
to automatically generate a commit message and commit your changes:commitly
- The tool will analyze your staged changes, generate a commit message using AI, and create the commit.
- Use the package's command
Handle Errors (If Any):
- If the tool encounters an issue (e.g., no internet connection, API failure, or empty staged changes), you will see an error message in the terminal.
- You can manually create a commit by running:
git commit -m 'Your commit message here'
Verify the Commit:
- To ensure your changes have been committed, you can check the latest commit using:
git log
- This will display the most recent commit details.
- To ensure your changes have been committed, you can check the latest commit using:
Contact
For any questions or feedback, feel free to reach out:
- LinkedIn: Tushar Kamra
- Email: tushar.kamra25@gmail.com