Adding to the idea of a local hook, you can:
That way, the process is automated and can retrieve the original name of the branch.
An alternative approach, which would use no hooks, would be to define the git-commit-template
in a git merge wrapper script. See for instance this answer.
Again, you could get the original name from the branch description, but this time inject it in the merge commit message template.
Note that, with Git 2.28 (Q3 2020), you cannot edit the description and set the upstream branch at the same time.
See commit dc44639, commit 6b70930, commit 6d504d5 (15 Jun 2020) by Denton Liu (Denton-L
).
(Merged by Junio C Hamano -- gitster
-- in commit 7b2685e, 25 Jun 2020)
branch
: don't mix --edit-description
Signed-off-by: Denton Liu
git branch
accepts --edit-description
in conjunction with other arguments. However, --edit-description
is its own mode, similar to --set-upstream-to
, which is also made mutually exclusive with other modes.
Prevent --edit-description
from being mixed with other modes.