Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

^M characters in git commit message (git commit -v)

I am having a weird problem where lots of ^M characters show up in my git commit message. Please find a screenshot attached. This is not causing any problems, just makes it annoying to read through.

enter image description here

Tips appreciated.

like image 742
Hendrik Avatar asked Mar 22 '12 15:03

Hendrik


People also ask

What does the M in git commit mean?

The most common option used with git commit is the -m option. The -m stands for message. When calling git commit , it is required to include a message. The message should be a short description of the changes being committed. The message should be at the end of the command and it must be wrapped in quotations " " .

How many characters is a commit message?

The defaults are 50 characters for the summary and 72 characters for the description, as recommended by the git tutorial and expanded upon by Tim Pope. commitmessage. maxSubjectLength : Maximum length of the commit message's subject line. Defaults to 50 if not specified or less than 0.

How many characters can be in a git commit?

Here's a short background about git commit hashes and short commit hashes: A commit in git always has a hash that contains 40 characters.

Can you use markdown in commit messages?

Use Markdown to format your text. Some tools like GitHub will render Markdown when showing commit messages. Use asterisks bullets when you need to explain a long list of changes.


2 Answers

"The Proper Way", if you use Git in cross-platform environment, contrary to Abhijeet's answer, is:

Learn and CORRECTLY configure core.autocrlf settings in each client

Read local topic "Why should I use core.autocrlf=true in Git?" as good starting point

like image 120
Lazy Badger Avatar answered Oct 24 '22 01:10

Lazy Badger


Thats a windows newline. Newlines in and windows & linux are different.

You can remove it using dos2unix.

Various ways of doing it: http://www.cyberciti.biz/faq/howto-unix-linux-convert-dos-newlines-cr-lf-unix-text-format/

like image 35
Abhijeet Rastogi Avatar answered Oct 24 '22 02:10

Abhijeet Rastogi