this post was submitted on 25 May 2026
9 points (100.0% liked)
Git
4652 readers
4 users here now
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Resources
Rules
- Follow programming.dev rules
- Be excellent to each other, no hostility towards users for any reason
- No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Thanks for the 2am nerd snipe :D
You can do this via git hooks and a script. Specifically the prepare-commit-msg hook (
.git/hooks/prepare-commit-msg). In your script, check for the GIT_REFLOG_ACTION env variable, and check if its value is "revert". If so, you are in a revert, and you can echo/printf out whatever you would like in your template.Might be a bit more work to get to where you want, but hopefully that points you in the right direction?
Thanks that is a great start, and even better gives me an excuse to faff about with scripting. I'll share what I come up with!
EDIT Oh interesting, in my debugging I found out that if you revert a revert now (git version 2.43.0) that the subject line reads "Reapply" instead of "Revert "Revert "..."""