diff --git a/README.md b/README.md index acb4efb..bcdcaff 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,11 @@ Generated command: git commit -m 'Update README with commit message example and ### Generate commit messages as a pre-commit hook -#### Install pre-commit +#### Install pre-commit & git-genie hooks ```shell pip install pre-commit +pre-commit install --hook-type commit-msg ``` #### Add pre-commit hook @@ -32,15 +33,28 @@ repos: #### Watch the magic happen ```shell -~/Personal/git-genie-pre-commit main* ❯ git add . && git commit -m "test" +~/Personal/git-genie-pre-commit main* ❯ git add . && git commit -m "git-genie please help me write a commit message" git-genie................................................................Passed -[main 0dc8c69] test 🧞: Specify specific revision and add '--mode=replace' argument to git-genie hook. +[main 0dc8c69] git-genie please help me write a commit message 🧞: Update .pre-commit-config.yaml for git-genie v0.1.1 Add --fix and --exit-non-zero-on-fix for ruff hooks. 1 file changed, 2 insertions(+), 1 deletion(-) ``` +In the above example, the commit message includes the original message and the message generated by git-genie. +If you with to replace the original message, use `--mode=replace` instead of `--mode=append`. + +The results will be similar to the following: + +```shell +~/Personal/git-genie-pre-commit main* ⇡ ❯ git commit -m "asdsakdfnlsknflag" 3.10.7 repobuddy 14:26:04 + +git-genie................................................................Passed +[main 9bf1d83] 🧞: Update pre-commit hook to use "--mode=replace" and change port mapping to "5435:5435". + 2 files changed, 2 insertions(+), 2 deletions(-) +``` + ### Generate & Explain complex git commands using plain english ![example](example.png) diff --git a/git_genie/main.py b/git_genie/main.py index bd458a4..3cfc38d 100644 --- a/git_genie/main.py +++ b/git_genie/main.py @@ -189,7 +189,9 @@ def generate_commit_message(diff: str) -> str: giving a command. The first line should be no longer than 50 characters and should start with a capital letter. The following lines should be no longer than 72 characters. - Only focus on the changed lines. Do not include lines that were not changed. + In the Changes below, the lines that start with a + are lines that were added. The lines that start with a - are + lines that were removed. Other lines are unchanged. Only focus on the changed lines. Do not include lines that + were not changed. Be direct, try to eliminate filler words and phrases in these sentences (examples: though, maybe, I think, kind of). Think like a journalist. Be concise. Be clear. Be consistent. Be professional. Be respectful.