I have been doing a oneline commit message for some time now but it doesn't give the entire information on the commit.
git commit -m "message"
I once used git Gui tool and it had option to do multiline commit message. One in header and one in detail. How do we do it from the command line?
And can some one explain any good practice to commit bug fix and new changes? I normally write "NEW:" or "FIX" at start of the commit message, i would like to know how you guys do this?
Another method of adding a multi-line Git commit message is using quotes with your message, though it depends on your shell's capacity. To do this, add single or double quotes before typing the message, keep pressing enter and writing the next line, and finally close the quote at end of the message.
To change the most recent commit message, use the git commit --amend command. To change older or multiple commit messages, use git rebase -i HEAD~N . Don't amend pushed commits as it may potentially cause a lot of problems to your colleagues.
-m flag helps add multiple paragraphs in the same Git commit message. You can do this by adding -m flag for more than once within your message.
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. You can add a co-author by adding a trailer to the commit.
You can do from the command line:
git commit -m 'First line
Second line
Third line'
Alternatively, you can just let git trigger your editor by doing
git commit
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