This is not correct; many infinitives are marked by "to" and many aren't. Such marking may, depending on context, be required, optional, or prohibited. For example, in "this can be a hassle", "be" is an infinitive. There just isn't any way to interpret it as an imperative. Who are you commanding?
And in the commit message "Add feature X", "add" is likewise an infinitive.
And in the commit message "Add feature X", "add" is likewise an infinitive.
https://glossary.sil.org/term/infinitive
https://glossary.sil.org/term/imperative-mood