Skip to content

feat(cp): support custom commit message templates - #1276

Closed
vjymisal0 wants to merge 2 commits into
tj:mainfrom
vjymisal0:feat/cp-commit-messages
Closed

vjymisal0 wants to merge 2 commits into
tj:mainfrom
vjymisal0:feat/cp-commit-messages

Conversation

@vjymisal0

@vjymisal0 vjymisal0 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add git cp --commit-template TEMPLATE. Every {} in the template is replaced with the default commit message, so text can go before or after it (e.g. --commit-template "#1252 {}" or --commit-template "{} [skip ci]"). The default is {}, so existing invocations keep their messages.

Verification

  • bats tests/git-cp.bats: 4 passed (prefix, suffix, missing value, default invocation)
  • Full bats ./tests suite: 88 passed
  • shellcheck bin/git-cp: clean
  • Man pages regenerated with Ronn-NG 0.9.0

Fixes #1252

Signed-off-by: vjymisal0 <misalvijay153@gmail.com>

@hyperupcall hyperupcall left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. I'm thinking that it may be useful to customize not just the prefix, but also the suffix as well. What do you think of passing --commit-template, with the default value being {}, which represents the message that is currently? There may be a better argument name or token which will be replaced with the substituted message.

Use a {} placeholder for the default commit message so text can be
added before or after it, as suggested in review. Regenerate the
git-cp man pages.

Signed-off-by: vjymisal0 <misalvijay153@gmail.com>
@vjymisal0

Copy link
Copy Markdown
Contributor Author

Good idea @hyperupcall, a template is more flexible than a prefix. I replaced --message-prefix with --commit-template, defaulting to {}. Every {} is replaced with the original commit message, so both --commit-template "#1252 {}" and --commit-template "{} [skip ci]" work. I kept {} as the token since it matches what you suggested, but happy to rename it if you have something else in mind.

Also regenerated git-cp.1/git-cp.html, which is what the lint job was complaining about. Added a suffix test; the full bats suite passes locally.

@vjymisal0 vjymisal0 changed the title feat(cp): support custom commit message prefixes feat(cp): support custom commit message templates Oct 2, 2026
@hyperupcall hyperupcall closed this Oct 2, 2026
@hyperupcall

Copy link
Copy Markdown
Collaborator

Closing this since the contribution policies were not followed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to customize commit messages in git-cp

2 participants