Commit prefix for merge commit
Is your feature request related to a problem? Please describe.
The remote I work with has a requirement to have a ticket ID in the commit title. For that purpose I use commit prefix feature.
However, when a I merge one branch into another with a merge commit, the merge commit uses default message "merged X into Y".
To fix that I need to go to the browser, copy ticket number, then edit the last commit message manually. This is inconvenient.
Describe the solution you'd like
I would like so that when I do a merge in lazygit, the merge commit message would automatically add the prefix I configured in the lazygit settings.
Describe alternatives you've considered
None.
Additional context
None.
Hello gikari,
I have the same need as you, but more complete : use a full template for both commit title and message (we put the ticket number at the message bottom instead of in the title).
In fact, Git already have a template feature, see commit.template configuration. It works well with the git commit command and fine with git gui (with a piece of bash script associated to an alias. I can share it).
So I think that lazygit shall just use the git configuration to find the commit template and use it. That seems reasonably feasible. That is the feature I really miss because it is painful to rewrite everything each time.
If no commit.template configuration defined, Lazygit could just use the last commit title as template by default.
What do you think about ?
So I think that lazygit shall just use the git configuration to find the commit template and use it. That seems reasonably feasible. That is the feature I really miss because it is painful to rewrite everything each time.
Does it work as expected if you use C to commit (Commit changes using git editor)?
Yes it does work ! Although there are a couple of disappointing things:
- Loading time is longer (1-2 seconds).
- I 'm not writing in a popup with repository metadata informations in background to help me write my commit message (but I'm in vim in the full terminal).
And one good point: I can choose to C or c to respectively write a well formed commit or a temporary one (no need to erase the full template in that case).
To conclude, it is a quite acceptable workaround for my use case but I would prefer not to leave lazygit. Thank you for helping !
If you haven't already, try adding commit.verbose = true in your .gitconfig in order to get more info when you're committing through the git editor.
E.g.:
[commit]
verbose = true
To conclude, it is a quite acceptable workaround for my use case but I would prefer not to leave lazygit.
Perfectly reasonable :)
This will have to do until proper support for commit.template is supported, or another solution is in place.
I didn't known this configuration, that helps. Thank you :)
We are using pre-commit hook for applying conventional commits. Everytime lazygit creates a merge commit I has to fix the commit message before I can continue merging. It would nice if we can set the prefix just to fix:.
We also have a commit message format, but is not fixed to anything. I suggest an added option to merge-commit with a custom message.