Often I work on projects where the commit message is not important to me. For example, contributing content to the same database again and again. Having to come up with commit messages is tedious and repetative, and I am happy with a generic date-time message.

So we can do:

git add .
git commit -m "$(date)"

This will output something like this:

[gh-pages df7b7c2] Tue 01 Feb 2022 20:06:45 IST

So far so good. But even writing every time git commit -m "$(date)" is annoying.

To mitigate that, we can add an alias to our ~/.bashrc or ~/.zshrc file:

alias commit="git commit -m \"$(date)\""

note that we had to escape the inner double-quoutes with a backslash.

To take effect, we have to close the terminal and reopen it again (only for the first time).

now every time we want to add changes and commit them we can just type:

git add .
commit

yielding the same result:

[gh-pages df7b7c2] Tue 01 Feb 2022 20:06:45 IST