RomanHotsiy / commitgpt

Automatically generate commit messages using ChatGPT
1.56k stars 91 forks source link

feat(index.ts): add current git branch name to prompt #36

Open albertcastaned opened 11 months ago

albertcastaned commented 11 months ago

Changes made

Example template for use, based on default template:

suggest 10 commit messages based on the following diff:
{{diff}}
commit messages should:
 - message format should be: {{currentBranch}}: <description>

examples:
 - {{currentBranch}}: add branch to prompt
 - {{currentBranch}}: add password regex pattern
 - {{currentBranch}}: add new test cases

Assuming we are working on a git branch named "BBR-3932" this would replace all the {{currentBranch}} instances.

Response example:

response:   - BBR-3932: add current branch to prompt
 - BBR-3932: add execSync to get current branch
 - BBR-3932: replace placeholder with current branch
 - BBR-3932: add error handling for branch command
 - BBR-3932: refactor index.ts
 - BBR-3932: update diff string
 - BBR-3932: update prompt template

This format could be adjusted per user through the local prompt template.

Fixes #10