Today I learned

June 07, 2020

Multiline commit messages

Stefan Judis showed in this tweet how to write multiline git commit messages.

Instead of writing one very looong commit message:

git commit -m 'this is a very long commit message where I describe all the work I did and guess what it is a lot and this should be just a short description'

You can use the -m flag multiple times. For every usage of it, a new line is added.

git commit -m 'at first I did this' -m 'I also did this' -m 'oh and dont forget that'

That's such a cool git feature I always needed but never knew how to do it!

Comes in really handy when you did several things in one commit and makes the commit history much more readable. I use it all the time now!

Greetings Marco

Go back to other today-I-learned posts