When cherry-picking a range of commits I can use -x
to append the line "(cherry picked from commit [commit])" to each commit message.
How do I customize this line to instead say "Backport of [commit] from master" ?
When cherry-picking a range of commits I can use -x
to append the line "(cherry picked from commit [commit])" to each commit message.
How do I customize this line to instead say "Backport of [commit] from master" ?
Use -e
or --edit
with your git cherry-pick
command; this will invoke your chosen editor on the commit message. You can then change the appropriate line manually.
If you want to automate the commit-message change, choose as your "editor" a script / program that will:
Do this just for the one git cherry-pick
command, by setting $GIT_EDITOR
(environment variable) or core.editor
(Git configuration setting) for the duration of the one command:
GIT_EDITOR=<path/to/script> git cherry-pick -x -e <commit-specifier>
or:
git -c core.editor=<path/to/script> cherry-pick -x -e <commit-specifier>
(Consider using sed -i ""
, for instance, to construct the editor-script.)