So I have a git repository that is a bit unusual, in that multiple people work on the same repository, using sudo
. (The goal in the long run is to get away from this, but for now, we're only taking small steps in improving our practices.)
Of course, that makes identifying who made each commit hard, but I have identified a sensible solution using environment variables (GIT_AUTHOR_NAME etc.).
To 'force' my colleagues into using this, I would like to add some automated verification in one of the hooks that runs before a commit is made:
- pre-commit
- prepare-commit-msg
- commit-msg
However, I cannot seem to find any way to find this information during these hooks. I could of course try to reinvent the wheel and go looking for environment variables and such, but I would very much prefer to not do this.
So does anyone know if there's a way to ask git for the author/committer names and emails that it intends to use for a staged commit? Or is that information only added to the commit after the pre-commit hook?