![](/img/trans.png)
[英]How to properly git commit -m 'message' OR git commit . -m 'message' ?
[英]^M characters in git commit message (git commit -v)
我有一個奇怪的問題,我的git提交消息中出現了很多^ M個字符。 請找到附帶的截圖。 這不會導致任何問題,只是讓閱讀煩人。
提示贊賞。
如果你在跨平台環境中使用Git,與Abhijeet的答案相反,“正確的方式”是:
學習並正確配置每個客戶端中的core.autocrlf設置
閱讀本地主題“我為什么要在Git中使用core.autocrlf = true?” 作為良好的起點
這是一個Windows換行。 和Windows和Linux中的換行符不同。
您可以使用dos2unix將其刪除。
各種方法: http : //www.cyberciti.biz/faq/howto-unix-linux-convert-dos-newlines-cr-lf-unix-text-format/
我在Windows上,並不想將autocrlf
設置為true
。 我通過將以下內容放在我的.vimrc中解決了這個問題
" settings for git commit messages
function GitCommitSettings()
%s/^M//g " remove ^M added by git diff
syntax sync fromstart " refresh syntax highlight after replace
1 " move to line 1
endfunction
au BufNewFile,BufRead COMMIT_EDITMSG call GitCommitSettings()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.