You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2026. It is now read-only.
feat(gitcommit): add commit history context for message generation
- introduce `use_commit_history` and `commit_history_count` options to include recent commit messages as context
- update generator to pass commit history to LLM prompt for improved style consistency
- implement `Git.get_commit_history` to retrieve recent commit messages from git log
- update configuration, types, and example config to support and document the new feature
- ensure commit history context is used across buffer, init, and generator modules
history_context="\nRECENT COMMIT HISTORY (for style reference):\n"
73
+
fori, commit_msginipairs(commit_history) do
74
+
history_context=history_context..string.format("%d. %s\n", i, commit_msg)
75
+
end
76
+
history_context=history_context.."\nAnalyze the above commit history to understand the project's commit style, tone, and format patterns. Use this as guidance to maintain consistency.\n"
77
+
end
78
+
75
79
returnstring.format(
76
-
[[You are a commit message generator. Generate exactly ONE complete Conventional Commit message for the provided git diff.
80
+
[[You are a commit message generator. Generate exactly ONE complete Conventional Commit message for the provided git diff.%s
77
81
78
82
CRITICAL FORMAT REQUIREMENTS:
79
83
1. MUST generate exactly ONE commit message, never multiple messages
@@ -95,8 +99,7 @@ RULES:
95
99
- Title: Use imperative mood ("add" not "added"), keep under 50 characters
96
100
- Body: At least ONE bullet point describing the changes
97
101
- For large diffs: Focus on the most significant changes, group related changes
98
-
- Choose the primary type that best represents the overall change
99
-
- Even with extensive changes, generate only ONE unified commit message
102
+
- If commit history is provided, follow the established patterns and style from recent commits
100
103
101
104
REQUIRED EXAMPLES:
102
105
feat(auth): add OAuth2 integration
@@ -116,6 +119,7 @@ Generate ONE complete commit message for this diff:
116
119
```
117
120
118
121
Return ONLY the commit message in the exact format shown above.]],
---@fieldshow_commit_messagefun(message: string, on_commit: fun(message: string): boolean): nil -- Show commit message in a floating window with interactive options
0 commit comments