Skip to content

Commit

Permalink
🧞: Update installation and usage instructions for pre-commit and git-…
Browse files Browse the repository at this point in the history
…genie hooks. Add guidelines for generating and explaining complex git commands.
  • Loading branch information
danthelion committed Nov 25, 2023
1 parent c529285 commit 75f8055
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion git_genie/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 75f8055

Please sign in to comment.