_______ __ .___________. _______ __ __ _______ _______
/ _____|| | | | / _____|| | | | | \ | ____|
| | __ | | `---| |----`| | __ | | | | | .--. || |__
| | |_ | | | | | | | |_ | | | | | | | | || __|
| |__| | | | | | | |__| | | `----.| | | '--' || |____
\______| |__| |__| \______| |_______||__| |_______/ |_______|
A Neovim plugin that streamlines your Git workflow by automating commit message generation and push operations. It supports both manual input and AI-generated commit messages using OpenAI's GPT or Google's Gemini models.
- Generate commit messages using AI (OpenAI's GPT or Google's Gemini)
- Manual commit message input option
- Automatic staging of all changes
- Commit changes with generated or manual messages
- Push all branches to origin
- Neovim notifications for important events and errors
- Customizable commands and keybindings
- Neovim 0.5 or later
- plenary.nvim (for HTTP requests)
- Git (installed and configured on your system)
- API key for OpenAI and/or Google Gemini (if using AI-generated commit messages)
Using packer.nvim:
use {
'goncaloalves/gitglide.nvim',
requires = {'nvim-lua/plenary.nvim'}
}Using lazy.nvim:
{
'goncaloalves/gitglide.nvim',
dependencies = {'nvim-lua/plenary.nvim'},
config = function()
require('git-commit-push').setup({
-- your configuration here
})
end
}You have two options for configuring your OpenAI and Gemini API keys:
1. Environment Variables (Recommended):
For better security, it's recommended to use environment variables. Set the following environment variables in your shell's configuration file (e.g., .bashrc, .zshrc, etc.):
OPENAI_API_KEY: Your OpenAI API key.GEMINI_API_KEY: Your Gemini API key.
Example (bash):
export OPENAI_API_KEY="your_actual_openai_key"
export GEMINI_API_KEY="your_actual_gemini_key"Add the following to your Neovim configuration file (usually init.lua):
require('git-commit-push').setup({
use_ai = true, -- Set to false for manual commit messages
ai_provider = "openai", -- Can be "openai" or "gemini"
openai_api_key = "your_openai_api_key_here", -- Optional (Environment Variables are more secure)
gemini_api_key = "your_gemini_api_key_here", -- Optional (Environment Variables are more secure)
command_name = "GitCommitPush" -- Custom command name
})use_ai: Boolean to enable or disable AI-generated commit messagesai_provider: String specifying the AI provider ("openai" or "gemini")openai_api_key: Your OpenAI API keygemini_api_key: Your Google Gemini API keycommand_name: Custom name for the main command (default: "GitCommitPush")
| Option | Default Value |
|---|---|
use_ai |
true |
ai_provider |
"openai" |
command_name |
"GitCommitPush" |
:GitCommitPush: Stage all changes, commit with a generated (or manual) message, and push to origin:GitCommit: Stage all changes and commit with a generated (or manual) message:GitPush: Push all branches to origin
<leader>gcp: Commit and push changes<leader>gcc: Commit changes<leader>gpp: Push changes
Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Q: I get an API key error, but I've set my environment variable!
A: Make sure you have restarted Neovim and your terminal session after exporting the environment variable for it to take effect. Also, double-check for any typos in OPENAI_API_KEY or GEMINI_API_KEY.