diff --git a/README.md b/README.md index 09fa881..721f553 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,49 @@ This will create a `.aicommits` file in your home directory. -4. Start committing! - Go make some changes in any Git repo, stage them, run `aicommits`, and see your AI generated message! +## Usage +### CLI mode + +You can call `aicommits` directly to generate a commit message for your staged changes: + +```sh +git add +aicommits +``` + +### Git hook + +You can also integrate _aicommits_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing. + +#### Install + +In the Git repository you want to install the hook in: +```sh +aicommits hook install +``` + +#### Uninstall +In the Git repository you want to uninstall the hook from: + +```sh +aicommits hook uninstall +``` + +#### Usage + +1. Stage your files and commit: + ```sh + git add + git commit # Only generates a message when it's not passed in + ``` + + > If you ever want to write your own message instead of generating one, you can simply pass one in: `git commit -m "My message"` + +2. Aicommits will generate the commit message for you and pass it back to Git. Git will open it with the [configured editor](https://docs.github.com/en/get-started/getting-started-with-git/associating-text-editors-with-git) for you to review/edit it. + +3. Save and close the editor to commit! + ## How it works