allowed-tools | description |
---|---|
Bash(git reset:*), Bash(git status:*), Bash(git diff:*), Bash(git branch:*), Bash(git log:*), Bash(git add:*), Bash(git commit:*), Bash(git show:*) |
Commit the current changes in one or more logical units. |
- Unstage all currently staged changes, but keep them in the working directory: !
git reset
- Current git status: !
git status
- Current git diff: !
git diff HEAD
- Current branch: !
git branch --show-current
- Recent commits: !
git log --oneline -10
Based on the above context, commit the changes.
- If all changes are related, commit them together with a single, clear commit message.
- If there are multiple unrelated changes, stage and commit them separately with distinct commit messages.
- Ensure commit messages are concise yet descriptive, following best practices (e.g., imperative mood, clear summary, mandatory body).
- If the change is simple, a simple body is sufficient. Otherwise, provide a detailed body explaining the what and why of the change.
- Ultrathink, and if the introduced change is not worth mentioning in the changelog, add the
$no-changelog
tag to the commit message.
(* Commit Message Structure *)
commit-message = subject-line, blank-line, body, blank-line, footers ;
(* Subject Line *)
subject-line = type-list, ": ", description ;
type-list = { type-spec, ",", [ " " ] }, type-spec ;
type-spec = type, [ "!" ], [ scope ] ;
type = "build" | "chore" | "ci" | "docs" | "feat" | "fix" | "misc"
| "perf" | "refactor" | "revert" | "style" | "test" ;
scope = "(", scope-text, ")" ;
scope-text = ? any text excluding parentheses ? ;
description = ? any text excluding newline ? ;
(* Body *)
body = text-line, { newline, text-line } ;
text-line = ? any text excluding newline ? ;
(* Footers *)
footers = [ breaking-change ], [ git-trailers ], tag ;
breaking-change = "BREAKING CHANGE: ", text-line, newline ;
git-trailers = git-trailer, { git-trailer } ;
git-trailer = trailer-token, ": ", trailer-value, newline ;
trailer-token = ? token as per git-interpret-trailers specification ? ;
trailer-value = ? value as per git-interpret-trailers specification ? ;
tag = "$", tag-name ;
tag-name = type, [ ",", [ " " ], "no-changelog" ] ;
(* Whitespace *)
blank-line = newline, newline ;
newline = "\n" ;
Example 1:
refactor!: Changed type of the message parameter from String to Message
BREAKING CHANGE: Method signature changed
$refactor
Example 2:
chore, refactor (service module): Refactored and reformatted ServiceManager
Refactored ServiceManager to be easier to comprehend
$refactor
Example 3:
feat(bundling), feat(vite), chore(deps-dev): Configured bundling and added vite to package.json
- Added vite to project
- Configured vite to bundle and minify the website resources
$feat, $no-changelog
Rule 1: Keep the first line of the commit message under 72 characters
- Rule 1: Every single file must be part of at least one commit. If a file is not part of any commit, you must stage and commit it.
- Rule 2: You must not stage or commit any changes that are not related to the commit message.
- Rule 3: You must follow the EBNF syntax for commit messages provided above.