In a repository where I cant set both user.name
and user.email
configurations I need to script a commit with:
commit -a --message "message" --author="author"
Message and author are parametrized.
When I commit with a wrong author (not present on rev-list
and bad formatted for git) I get:
fatal: --author 'bad-formatted-author' is not 'Name ' and matches no existing author
Is there any way to check against git if the author is valid before the commit?
Use git commit -a --message "message" --author="author" --dry-run
.
The added --dry-run
flag will make git commit
not actually commit anything but still exit non-zero if the --author
option string given is invalid.
Note, however, that there may be other reasons the exit status is non-zero, such as the commit being empty (i.e. not having any changes).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With