Skip to content

Instantly share code, notes, and snippets.

@mrclrchtr
Last active March 21, 2024 19:43
Show Gist options
  • Save mrclrchtr/12d25285177c28f60125c351106403fa to your computer and use it in GitHub Desktop.
Save mrclrchtr/12d25285177c28f60125c351106403fa to your computer and use it in GitHub Desktop.
ChatGPT - Create Conventional Commit Message - ai-commits-intellij-plugin

Create a commit message based on the Conventional Commit Convention using the provided 'git diff --staged' output. The message should succinctly summarize the changes and their impact, following these guidelines:

  • Title: Start with a commit type (e.g., fix, feat, refactor), include an optional scope in parentheses, and add a concise description within 74 characters, not ending with a period.
  • Body: Provide more context or rationale behind the changes with detailed descriptions or bullet points.
  • Footer: Add metadata like BREAKING CHANGE, Closes #<issue_id>, etc., if appropriate.
  • Issue ID: If and only if available, include the issue ID from '{branch}' in the Closes #<issue_id>, else don't!
  • Language: Write the commit message in '{locale}'.
  • Emojis: Incorporate relevant emojis to enhance the message, if appropriate.
  • Line Breaks: Insert line breaks thoughtfully, mainly after periods.
  • Semantic Release: Ensure the message aligns with semantic release guidelines for classifying release types.

Commit Types:

  • refactor: Improve internal structure without altering external behavior.
  • fix: Address issues to ensure functionality.
  • feat: Introduce new features or functionalities.
  • Additional types: build, chore, style, test, docs, perf, ci, revert, wip as previously detailed.

Footer Types:

  • Include BREAKING CHANGE, Closes, Implements, Author, Co-authored-by, Signed-off-by, Acked-by, Reviewed-by, Tested-by, Refs as outlined earlier.

Craft the commit message focusing solely on the provided details, avoiding extraneous information or assumptions. Do not wrap your response in any markdown or code block syntax!

{A hint by the commiter for you to optimize the message: $hint}

And the diff: {diff}

@mrclrchtr
Copy link
Author

mrclrchtr commented Mar 20, 2024

Write a meaningful but as compact as possible commit message in the Conventional Commit Convention by summing up, thus being specific, to what changed.
I'll send you an output of 'git diff --staged' command, and you convert it into a commit message.
Lines must not be longer than 74 characters. Use {locale} language to answer.
End commit title with issue number if only and only if you can get it from the branch name: {branch} in parenthesis, else don't do this.
You may use relevant emojis to enhance the message, if appropriate.
Try to use line breaks, only after a dot, to help making the commit message easier to read.

Commit message format:
type(scope): description (no ending period, under 74 characters)

Optional body text.

Optional footer, e.g., Closes: http://issue-tracker.com/issue-number

Example:
refactor(api): optimize data retrieval logic

Improved performance by caching results.

Closes: http://issue-tracker.com/123

The commit description (which comes right after the "type(scope):" must not be sentence-case, start-case, pascal-case, upper-case [subject-case] and not end with a period (.) and must not be over 74 characters in length.
The footer (which in the example is "Closes: http://issue-tracker.com/123") is optional and should only be used if one or some matching "footerTypes" can be identified in the diff. If you can't identify any footer type, don't use the footer.

"refactor" is the type, I'll list all possible types.
"api" is the scope, I'll list all possible scopes.
"Closes" is the footer_type

Possible types, scopes and footer types:
types:
refactor: {identificationStrategies: ["Large number of lines changed with no new functionality", "Renaming files or functions", "Reorganizing code structure"], description: "Changes which neither fix a bug nor add a feature."}
fix: {identificationStrategies: ["Changes in code logic to address a malfunction", "Modifications in test assertions or conditions"], description: "Changes which patch a bug in the codebase."}
feat: {identificationStrategies: ["Addition of new files or functions", "Significant code additions introducing new behavior"], description: "Changes which introduce a new feature to the codebase."}
build: {identificationStrategies: ["Modifications to build scripts or dependency files"], description: "Changes which affect the build system or external dependencies.", scopes: {gradle: {identificationStrategies: ["Changes in .gradle files", "Adjustments in gradle configurations"], description: "Changes which affect the Gradle build system."}, yarn: {identificationStrategies: ["Changes in package.json or yarn.lock files"], description: "Changes which affect the Yarn build system."}}}
chore: {identificationStrategies: ["Updates in non-source files like .gitignore, Dockerfile", "Changes in repository settings or configuration files"], description: "Changes which are not user-facing.", scopes: {project: {identificationStrategies: ["Adjustments in project configuration files like .editorconfig"], description: "Changes which affect project configuration files."}, deps: {identificationStrategies: ["Updates in dependencies in package.json, Gemfile, etc."], description: "Changes which update dependencies."}}}
style: {identificationStrategies: ["Formatting changes", "Correction of typos in code", "Adjustments in code styling without changing logic"], description: "Changes which do not affect code logic."}
test: {identificationStrategies: ["Addition or modification of test files", "Changes within test directories"], description: "Changes which add missing tests or fix existing ones."}
docs: {identificationStrategies: ["Changes to documentation files (.md, .rst)", "Updates in inline code comments"], description: "Changes which affect documentation.", scopes: {business: {identificationStrategies: ["Modifications in business-related documents"], description: "Changes which update or add business documentation."}, technical: {identificationStrategies: ["Updates in API documentation, code comments"], description: "Changes which update or add technical documentation."}, readme: {identificationStrategies: ["Changes in README files"], description: "Changes which update or add the README file."}}}
perf: {identificationStrategies: ["Code changes aimed at improving performance", "Optimization of existing algorithms"], description: "Changes which improve performance."}
ci: {identificationStrategies: ["Modifications to CI/CD pipeline scripts or configurations"], description: "Changes which affect CI configuration files and scripts.", scopes: {github-actions: {identificationStrategies: ["Changes in GitHub Actions workflow files (.github/workflows)"], description: "Changes which affect GitHub Actions configuration files."}}}
revert: {identificationStrategies: ["Code changes that undo previous changes", "Presence of 'revert' in commit message"], description: "Changes which revert a previous commit."}
wip: {identificationStrategies: ["Partial changes or temporary adjustments", "Use of 'WIP' in commit message or comments"], description: "Changes which are work in progress."}
footerTypes:
BREAKING CHANGE: {description: "Indicates that the commit introduces changes that break the API compatibility.", identificationStrategies: ["Usage of 'BREAKING CHANGE:' prefix in commit messages", "Major changes in code that require version bump"]}
Closes: {description: "Signifies that the commit addresses and resolves a specific issue or pull request.", identificationStrategies: ["Inclusion of 'Closes #issueNumber' in commit messages", "Referencing specific issues or PRs that the commit resolves"]}
Refs: {description: "References other commits or materials, providing context or links to additional information.", identificationStrategies: ["Usage of 'Refs' followed by a hash ID or link in commit messages", "Including commit hash IDs or URLs for additional context"]}

The scopes are only Examples! You may and should identify scopes on your own!
The descriptions should help you to identify the specified kind.
The identificationStrategies should help you to identify the specified kind.

This is the diff:
{diff}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment