I'm wondering if it is possible to build git commit messages incrementally, documenting what I'm doing as I make code changes:
Is there any mechanism built into git to do this?
On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit.
The ideal size of a git commit summary is around 50 characters in length. Analyzing the average length of commit messages in the Linux kernel suggests this number.
git commit
can take a commit message from a file using the -F
option. So, you can do something like this:
# Do some work
$ echo 'Did some work' > commit-msg.txt
# Do some more work
$ echo 'Did some more work' >> commit-msg.txt
$ git commit -F commit-msg.txt
You are supposed to do a commit for every small change you do that requires a message. This is especially easy with a distributed versioning system like git that you are using.
And if you for some reason dislike this pattern and want to do the way you described, just use notepad and append to your message after coding a while and then copy paste it when commiting.
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