Skip to content

Commit 4db4865

Browse files
committed
Update git-context documentation to focus on minimalist design
The documentation for `git-context` has been simplified to emphasize a more focused and streamlined approach. Key changes include: - Reduced command-line options - Simplified usage and examples - Clarified tool's primary purpose - Added pipeline usage examples - Updated output and workflow descriptions
1 parent 5c26c95 commit 4db4865

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

docs/git-context.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,32 @@
1-
# `git-context` - Git Context Generator
1+
# `git-context` - Minimalist Git Context Generator
22

33
## Overview
44

5-
The `git-context` tool generates git-related context specifically to help LLMs create meaningful commit messages.
5+
The `git-context` tool generates essential git-related context to help LLMs create meaningful commit messages. This simplified version focuses on providing only the most useful information for commit message generation.
66

77
## Usage
88

99
```bash
10-
./git-context --diff --recent-commits=2 --prompt --conventional > commit_context.txt
10+
./git-context [options] > commit_context.txt
1111
```
1212

1313
## Arguments
1414

1515
| Argument | Description | Default |
1616
|----------|-------------|---------|
17-
| `--diff` | Show uncommitted changes | True |
18-
| `--no-diff` | Don't show uncommitted changes | False |
19-
| `--staged` | Show only staged changes | False |
20-
| `--unstaged` | Show only unstaged changes | False |
2117
| `--recent-commits=<num>` | Show most recent N commits for context | 3 |
22-
| `--files=<pattern>` | Include only files matching pattern | None |
23-
| `--exclude=<pattern>` | Exclude files matching pattern | None |
24-
| `--format=<format>` | Output format (md, json, text) | "md" |
25-
| `--prompt` | Include commit message generation prompt | False |
26-
| `--conventional` | Add conventional commit format guidance | False |
27-
| `--project-context` | Include project name and description for context | False |
28-
| `--branch-info` | Include current branch and related info | False |
18+
| `--prompt=<file>` | Use custom commit message prompt from file | "prompts/commit_prompt.txt" |
19+
| `--no-prompt` | Don't include commit message prompt | False |
2920

3021
## Output
3122

32-
The tool outputs git context information, which typically includes:
23+
The tool outputs git context information in markdown format, which includes:
3324

34-
1. Git diff of uncommitted/staged changes
35-
2. Information about files changed (stats)
36-
3. Recent commit messages for style reference
37-
4. Optional prompt to guide the LLM in generating a good commit message
25+
1. Git status summary
26+
2. Git diff of uncommitted changes against HEAD
27+
3. List of files changed with their status
28+
4. Recent commit messages for style reference
29+
5. Commit message guidance from prompts/commit_prompt.txt
3830

3931
## Examples
4032

@@ -48,48 +40,56 @@ Generate context for a commit message:
4840

4941
### Conventional Commits
5042

51-
Include guidance for conventional commit format:
43+
Use the conventional commits format guidance included in the repository:
5244

5345
```bash
54-
./git-context --prompt --conventional > commit_context.txt
46+
./git-context --prompt=prompts/conventional_commit.txt > commit_context.txt
5547
```
5648

57-
### With Project Context
49+
This uses the pre-defined conventional commit format guidance from the prompts directory.
5850

59-
Include project information for better context:
51+
### Without Prompt
6052

61-
```bash
62-
./git-context --project-context --branch-info > commit_context.txt
63-
```
64-
65-
### Staged Changes Only
66-
67-
Only include changes that have been staged:
53+
Generate context without the commit message guidance:
6854

6955
```bash
70-
./git-context --staged --prompt > commit_context.txt
56+
./git-context --no-prompt > commit_context.txt
7157
```
7258

73-
### JSON Output
59+
### Adjust Number of Recent Commits
7460

75-
Generate context in JSON format:
61+
Show more or fewer recent commits:
7662

7763
```bash
78-
./git-context --format=json > commit_context.json
64+
./git-context --recent-commits=5 > commit_context.txt
7965
```
8066

8167
## Customization
8268

8369
The commit message prompt template is stored in `prompts/commit_prompt.txt` and can be customized to your project's needs.
8470

85-
If the `--conventional` flag is used, the tool will also include guidance from `prompts/conventional_commit.txt`.
71+
For conventional commits or other specialized formats, create a custom prompt file and specify it with the `--prompt=` option.
8672

8773
## Workflow Integration
8874

8975
Typical workflow:
9076

9177
1. Make changes to your code
92-
2. Stage changes with `git add`
93-
3. Run `./git-context --staged --prompt > commit_context.txt`
94-
4. Send commit_context.txt to an LLM to generate a commit message
95-
5. Use the generated message with `git commit -m "generated message"`
78+
2. Run `./git-context > commit_context.txt`
79+
3. Send commit_context.txt to an LLM to generate a commit message
80+
4. Use the generated message with `git commit -m "generated message"`
81+
82+
## Pipeline Examples
83+
84+
```bash
85+
# Generate commit message and use it directly (using an LLM CLI tool)
86+
git commit -am "$(./git-context | llm -m openrouter/anthropic/claude-3.5-haiku)"
87+
88+
# Generate commit message but edit it before committing
89+
git commit -am "$(./git-context | llm -m openrouter/anthropic/claude-3.5-haiku)" -e
90+
91+
# Generate a conventional commit message with editing option
92+
git commit -am "$(./git-context --prompt=prompts/conventional_commit.txt | llm -m openrouter/anthropic/claude-3.5-haiku)" -e
93+
```
94+
95+
The `-e` or `--edit` option opens the commit message in your default editor, allowing you to review, edit, or cancel the commit if needed.

0 commit comments

Comments
 (0)