https://github.com/zcaceres/magic-diff
Never write a commit message ever again
https://github.com/zcaceres/magic-diff
Last synced: about 1 month ago
JSON representation
Never write a commit message ever again
- Host: GitHub
- URL: https://github.com/zcaceres/magic-diff
- Owner: zcaceres
- License: mit
- Created: 2025-01-13T04:58:01.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-02-25T18:46:25.000Z (8 months ago)
- Last Synced: 2025-04-23T23:13:21.396Z (6 months ago)
- Language: Shell
- Size: 1.41 MB
- Stars: 16
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# magic_diff

magic_diff is a command-line tool that automates your git commit messages. You stage changes, it writes your commit.
## Features
- Automatically generates a git commit message based on staged changes using an LLM of your choice
- Copies the generated message to your clipboard for easy pasting
- Supports multiple clipboard tools (pbcopy, xclip, clip)## Prerequisites
- Git
- [llm](https://github.com/simonw/llm) - A command-line interface for interacting with large language models## Installation
1. Clone this repository:
```
git clone https://github.com/zcaceres/magic-diff.git
cd magic-diff
```2. Move the contents of magic_diff.sh into your PATH (.zprofile, .bashrc etc.)
```
chmod +x magic_diff.sh
```## Setup
1. Install the `llm` tool if you haven't already:
```
brew install llm
```2. (Optional) Install plugins for other model providers such as....
```
llm install llm-claude-3
llm install llm-gemini
```2. Set up your OpenAI/Anthropic/other provider API key:
```
llm keys set openai
```3. (Recommended) Set a cheap but effective default model:
```
llm models default gpt-4o-mini
```## Usage
1. Stage your changes in git as usual:
```
git add .
```2. Run magic-diff:
```
magic_diff
```3. The script will generate a commit message based on your staged changes and copy it to your clipboard.
4. Paste the generated message into your git commit command or GUI.
## Customization
You can modify the prompt used to generate the commit message by editing the `llm` command in the `magic_diff()` function of the script.
## Troubleshooting
- If you encounter issues with clipboard functionality, ensure you have one of the supported clipboard tools installed (pbcopy, xclip, or clip).
- If the `llm` command is not found, make sure it's installed and in your PATH.## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is open source and available under the [MIT License](LICENSE).
## Credits
Thanks Chong-U Lim for inspiration for the environment-neutral copy functionality.